Android Facebook SDK getRequestForPagedResults always null

I'm trying to crawl every photo a page has uploaded to Facebook with pagination. Although the Facebook response has Pagination Details in both the response and the Graph Explorer tool, the response.getRequestForPagedResults method always returns null. Does anyone know why?

Here is my code

GraphRequest request = GraphRequest.newGraphPathRequest(accessToken, "/" + timelinePhotos,
            new GraphRequest.Callback() {
                @Override
                public void onCompleted(GraphResponse response) {
                    GraphRequest nextRequest =      response.getRequestForPagedResults(GraphResponse.PagingDirection.NEXT);
                    Log.e("HALLO", response.toString());
                    JSONObject obj = response.getJSONObject();
                    JSONArray data = null;

                        if(nextRequest!=null){
                            nextRequest.setCallback(this);
                            nextRequest.executeAsync();
                        }else{
                            Log.e("HI", "ICHBINFEDDIIICH");
                        }


                }
            });

    Bundle parameters = new Bundle();
    parameters.putString("fields", "photos{likes.limit(0).summary(true)}");
    request.setParameters(parameters);
    request.executeAsync();

      

Here is the response I get from facebook

 01-04 04:42:03.564: E/HALLO(983): {Response:  responseCode: 200, 
    graphObject: {"id":"853505791349630","photos":{"data":  
    [{"id":"1187285891304950","likes":{"summary":
{"can_like":true,"total_count":678,"has_liked":false},"data":[]}},  
{"id":"1185272354839637","likes":{"summary":
{"can_like":true,"total_count":2245,"has_liked":false},"data":[]}},
{"id":"1184689078231298","likes":{"summary"
:{"can_like":true,"total_count":3242,"has_liked":false},"data":[]}}, ....lots of more IDS


"paging":{"cursors":    {"after":"MTE2NzU2MDEyOTk0NDE5MwZDZD","before":"MTE4NzI4NTg5MTMwNDk1MAZDZD"},"ne
xt":"https:\/\/graph.facebook.com\/v2.5\/853505791349630\/photos?
access_token=XXX
jKzSgbusvQKMXtXmIsgl01T
vTEPQBZCp3XhM8ieGCYclmmuc7FzVDyl8jcJTW&
fields=likes.limit%280%29.summary%28true%
29&limit=25&after=MTE2NzU2MDEyOTk0NDE5MwZDZD"}}}, error: null}

      

So, as you can see, the Paging-Information is obvious, so why is my nextRequest always zero?

+2


source to share





All Articles