age_range
from facebook./me?fields=age_range
in my GraphRequest.newGraphPathRequest
i get an error.graphObject
returns null
. I've tried using /me
and it works i get the correct user data though when i use /me?fields=age_range
i get this error.Testing﹕ {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.}}
This is the code i've been trying to fix.
GraphRequest request = GraphRequest.newGraphPathRequest(accessToken,
"/me?fields=age_range",
new GraphRequest.Callback() {
@Override
public void onCompleted(GraphResponse graphResponse) {
Log.v("Testing", graphResponse.toString());
}
});
request.executeAsync();
You should not put "/me?fields=age_range" as the path in your GraphRequest.
Instead, only use "/me" as the path, and then create a new Bundle, and put "fields" as the key, and "age_range" as a string value, and set the new bundle as the parameters on the GraphRequest.
GraphRequest request = ...
...
Bundle params = new Bundle();
params.putString("fields", "age_range");
request.setParameters(params);
request.executeAsync();
...