Facebook graph api cursor based paging not working in android -


i trying pages url liked user. i'm able fetch records using below method, paging not working. i'm getting same data every time same before - after cursor token lead infinite loop. limit params not working.

request:

final string[] afterstring = {""};  // contain next page cursor final boolean[] nodata = {false};   // stop when there no after cursor              {                  graphrequest request = graphrequest.newmerequest(                         accesstoken.getcurrentaccesstoken(),                         new graphrequest.graphjsonobjectcallback() {                             @override                             public void oncompleted(jsonobject object, graphresponse response) {                                 jsonobject jsonobject = response.getjsonobject();                                 log.e("cursor data", jsonobject.tostring());                                   try {                                     jsonobject childobject = jsonobject.getjsonobject("likes");                                     jsonarray jsonarray = childobject.getjsonarray("data");                                      log.e("cursor data", jsonarray.tostring());                                     //  code                                       if (!childobject.isnull("paging")) {                                         jsonobject paging = childobject.getjsonobject("paging");                                         jsonobject cursors = paging.getjsonobject("cursors");                                         if (!cursors.isnull("after"))                                             afterstring[0] = cursors.getstring("after");                                         else                                             nodata[0] = true;                                     } else                                         nodata[0] = true;                                 } catch (jsonexception e) {                                     e.printstacktrace();                                 }                             }                         });                  bundle parameters = new bundle();                 parameters.putstring("fields", "likes{link}");                 parameters.putstring("after", afterstring[0]);                 parameters.putstring("limit", "20");                 request.setparameters(parameters);                 request.executeandwait();              }             while (!nodata[0] == true); 

response:

{   "likes": {     "data": [       {         "link": "https:\/\/www.facebook.com\/hackingworld27\/",         "id": "206659129366770"       },       {         "link": "https:\/\/www.facebook.com\/getbksy\/",         "id": "259965487527431"       },       {         "link": "https:\/\/www.facebook.com\/festivallapp\/",         "id": "1688234858119600"       },       {         "link": "https:\/\/www.facebook.com\/festivalbooks-967208323354910\/",         "id": "967208323354910"       },       {         "link": "https:\/\/www.facebook.com\/subhamfashion\/",         "id": "1454168668186632"       },      ],     "paging": {       "cursors": {         "before": "mja2nju5mti5mzy2nzcw",         "after": "mteymtgwmju1ndg2mti0"       }     }   },   "id": "858224610968939" } 

above response sample response. tried send request user id has liked many pages, getting same 25 records maximum every time.


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -