5
I followed the tutorial from Facebook SDK to implement the game Friend Smash. In Activity Home has a button to view the Scores. However, when clicking it shows a connection error on the screen:
Please check your network Connection -- Facebookoperationcanceledexception error
Before that he was already logged in to the user, and presented without problems the name and the photo after accepting the request for permission of the game on my facebook.
In log.cat he presented the following error:
01-31 13:25:36.791: E/friendsmash(5312): org.json.Jsonexception: Value false of type java.lang.Boolean cannot be converted to Jsonarray
Searching solution, I found the following lines 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, as the example already brings the http://www.friendsmash.com/
, but I didn’t set this when I created the app on Facebook. This application already exists on Facebook, this can 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 on Facebook.