android - How to get friendlist from facebook -
i trying friend list facebook not able friend list. tried out different code null in response. if run sample scrumptious app don't friend list. suggest me use "me/taggable_friends"
still not getting friend list.
so want know whether possible friend list facebook. if yes please show me way.
public class mainactivity extends activity { private final static string tag = "mainactivity"; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); session.openactivesession(this, true, new session.statuscallback(){ @override public void call(session session, sessionstate state, exception exception) { requestmyappfacebookfriends(session); } }); } private request createrequest(session session) { request request = request.newgraphpathrequest(session, "me/taggable_friends", null); set<string> fields = new hashset<string>(); string[] requiredfields = new string[] { "id", "name", "picture"}; fields.addall(arrays.aslist(requiredfields)); bundle parameters = request.getparameters(); parameters.putstring("fields", textutils.join(",", fields)); request.setparameters(parameters); return request; } private void requestmyappfacebookfriends(session session) { request friendsrequest = createrequest(session); friendsrequest.setcallback(new request.callback() { @override public void oncompleted(response response) { list<graphuser> friends = getresults(response); log.v(tag, "friends list size "+friends.size()); } }); friendsrequest.executeasync(); } private list<graphuser> getresults(response response) { graphmultiresult multiresult = response.getgraphobjectas(graphmultiresult.class); graphobjectlist<graphobject> data = multiresult.getdata(); return data.casttolistof(graphuser.class); } @override public void onactivityresult(int requestcode, int resultcode, intent data) { super.onactivityresult(requestcode, resultcode, data); session.getactivesession().onactivityresult(this, requestcode, resultcode, data); }
facebook has made significant changes in 2.0 version. 1 of change friends list. able obtain friendslist /me/friends
endpoint doesn't work v2.0.
you've used correct api— /me/taggable_friends
, thing needs reviewed facebook first use in live app. here explained how submit review.
for testing purpose, switch app development mode or test app developers/admins/testers account only; else you'll blank response.
Comments
Post a Comment