Getting paginated user likes using Facebook SDK on Android -
I am trying to retrieve the user's choice of user by using graph ap for Android. This is my code:
bundle parameters = new bundle (); Params.putString ("id", graphUser.getId ()); // getId () returns the current User ID parameter. Input string ("field", "likes.limit (100)"); Request Request = New Request (Session, "Me", Consulting, HTTP Method, Callback); // Callback response call callback function is RequestAsyncTask function = New RequestAsyncTask (request); Task.execute (); Whatever range I've added to the number of likes (1000,10000, etc.), the Graph API returns a maximum of 100 likes in a response with "Next" element within the response Which is the URL to retrieve the next group of 100 likes. The "next" url is of type:
where 1206543003 is some random user id now, this is where I got stuck. I do not know what to do with the next "URL" and how to get to the next set (and finally all the user's choice page). I have ruined the entire day (and a half) that attempts to find something in the Facebook SDK documentation which tells how I can go about it, but nothing is available till now.
This is the answer when I call to get the first 100 choices:
{responseCode: 200, Graph object: Graph object {graphObjectClass = GraphObject, state = { "Id": "1206543004", "like": {"data": [{"id": "334867149911874", "Created time": "2014-10-02T12: 57: 07 + 0000", "Category" : "", "Name": "", "name": "", "name": "OSOM"}, "" "" "," name ". . . . ], "Paging": {"cursor": {"later": "NTQwMjk3MTQ5MzQ1NjMw", "first": "MzM0ODY3MTQ5OTExODc0"}, "Next": "https: \ / \ / graph.facebook.com \ / v1.0 \ / & Lt; User ID> Favorites / Access_token = & lt; Access token & gt; & amp; limit = 100 & amp; NTQwMjk3MTQ5MzQ1NjMw}}}} Use the offset 0 along with the range after
offset 0 (insert data in the list) with limit 100
= " Use limit 100 with offset 100 (post data in the list)
Offset 100 with limit 100 Use (insert data in the list)
....
....
Unless you get blank / no data
Use Data Cheers!
Comments
Post a Comment