I followed the Facebook tutorial SDK to implement the game Friend Smash . In Activity Home you have a button to view the Scores. However, clicking on it displays a connection error on the screen:
Please check your network connection - FacebookOperationCanceledException error
Before that he was already logged in and presented the name and photo without any problems after accepting the game permission request on my facebook.
At log.cat it presented the following error:
01-31 13: 25: 36.791: E / FriendSmash (5312): org.json.JSONException: Value false of type java.lang.Boolean can not be converted to JSONArray
Looking for solution, I found the following lines where where the problem happened. The string getURL
returns FALSE
.
// Get the attributes used for the HTTP GET
String currentUserFBID = application.getCurrentFBUser().getId();
String currentUserAccessToken = Session.getActiveSession().getAccessToken();
// Execute the HTTP Get to our server for the scores of the user's friends
HttpClient client = new DefaultHttpClient();
String getURL = "http://www.friendsmash.com/scores?fbid=" + currentUserFBID + "&access_token=" + currentUserAccessToken;
HttpGet get = new HttpGet(getURL);
HttpResponse responseGet = client.execute(get);
// Parse the response
HttpEntity responseEntity = responseGet.getEntity();
String response = EntityUtils.toString(responseEntity);
JSONArray responseJSONArray = new JSONArray(response);
An initial question is whether this url is created automatically, because the example already has http://www.friendsmash.com/
, but I did not set it when I created the application in Facebook developer . This application already exists on Facebook, can this cause conflict?
Any solution? The code is the same as the one downloaded from the tutorial and I followed the tutorial for creating a new application in Facebook developer .