Android - Get list of all friends on facebook -
i'm tring list of friends facebook, return empty data :
{response: responsecode: 200, graphobject: {"data":[],"summary":{"total_count":482}}, error: null}
i'm using facebook-android-sdk:4.16.1.
loginbutton = (loginbutton)findviewbyid(r.id.login_button); loginbutton.setreadpermissions("user_friends"); loginbutton.setreadpermissions("public_profile"); loginbutton.setreadpermissions(arrays.aslist("email")); loginbutton.setreadpermissions("user_birthday"); loginbutton.registercallback(callbackmanager, new facebookcallback<loginresult>() { @override public void onsuccess(loginresult loginresult) { // email address graphrequest request = graphrequest.newmerequest(loginresult.getaccesstoken(), new graphrequest.graphjsonobjectcallback() { @override public void oncompleted(jsonobject object, graphresponse response) { log.i("loginactivity", response.tostring()); imodel.setuseremail("not available"); try { string email = object.getstring("email"); imodel.setuseremail(email); log.i("loginactivity - email", object.getstring("email")); } catch (jsonexception e) { e.printstacktrace(); log.i("loginactivity - email", "error"); } } }); bundle parameters = new bundle(); parameters.putstring("fields", "id, first_name, last_name, email,gender, birthday, location"); // parĂ¡metros que pedimos facebook request.setparameters(parameters); request.executeasync(); // list of friends new graphrequest( accesstoken.getcurrentaccesstoken(), "/me/friends", null, httpmethod.get, new graphrequest.callback() { public void oncompleted(graphresponse response) { log.d("oncompleted - friens", response.tostring()); jsonobject json = response.getjsonobject(); jsonarray friendarray = null; try { friendarray = json.getjsonarray("data"); } catch (jsonexception e) { log.d("json - parse", "error"); } arraylist<string> friendsnames = new arraylist<string>(); for(int = 0; i< friendarray.length(); i++) { jsonobject frnd_obj = null; try { frnd_obj = friendarray.getjsonobject(i); friendsnames.add(frnd_obj.getstring("name")); } catch (jsonexception e) { log.d("json - list", "error"); } } } } ).executeasync(); onlogincompeleted(); }
i read somewhere not longer possible friend on facebook , , can friend have same application.
it's true? or have problem on code. thanks.
Comments
Post a Comment