Reputation: 101
In my app I'm using new facebook SDK (3). From the main Activity user can click different buttons, after click new Activity is started and shows different lists: one with messages, second with friend requests and third with notifications. Everything works fine with first two cases but when I want to show notifications by making graphpath request like:
Request.executeGraphPathRequestAsync(session, "me/notifications?include_read=true",
new Request.Callback() {}
I get an error:
{Response: responseCode: 400, graphObject: null, error: {HttpStatus: 400, errorCode: 2500, errorType: OAuthException, errorMessage: An active access token must be used to query information about the current user.}, isFromCache:false}
I've already asked for read permissions (read_mailbox, read_requests) and for publish permission (manage_notifications). I think I have to pass an access token to my activity with notifications list but I don't know how to do that, thanks for help
Solution
I found the solution, it's just we can't put parameters such as "include_read=true" directly to graphpath request, we have to make a new Request object with these parameters: session, httpmethod, parameters, graphpath, callback.
Upvotes: 1
Views: 1422
Reputation: 4397
Thanks Janek for answering your own question, as you mentioned the parameters need to be sent separately and not as part of the graphPath, I am just posting an example of your solution in case someone has the same issue:
new Request(session, "me", getRequestParameters(), null, new Request.Callback() { ... }).executeAsync();
private Bundle getRequestParameters() {
Bundle parameters = new Bundle(1);
parameters.putString("fields", "id,name,first_name,last_name,gender,picture");
return parameters;
}
Upvotes: 1