I'm requesting my me/albums
with:
new GraphRequest(
AccessToken.getCurrentAccessToken(),
"/me/albums",
null,
HttpMethod.GET,
new GraphRequest.Callback() {
public void onCompleted(GraphResponse response) {
parseAlbumResponse(response);
}
}).executeAsync();
Problem is that the response object only contains 3 fields:
{
"data": [
{
"created_time": "...",
"name": "...",
"id": "..."
},
...
Instead of all fields documented here. Sames goes for /{album-id}/photos
:
{
"data": [
{
"created_time": "...",
"id": "..."
},
...
Instead of this. It was working last time I've checked but all of a sudden this strange behaviour happened. I've tested with Facebook Graph API and the result it's the same so I guess it's not a problem from my app.
I'm using 'com.facebook.android:facebook-android-sdk:4.7.0'
.
Did Facebook changed something in the requests parameters?
EDIT: As user luschn suggested:
Declarative Fields
To try to improve performance on mobile networks, Nodes and Edges in v2.4 requires that you explicitly request the field(s) you need for your GET requests. For example, GET /v2.4/me/feed no longer includes likes and comments by default, but GET /v2.4/me/feed?fields=comments,likes will return the data. For more details see the docs on how to request specific fields.
So I had to change my requests to:
Web console:
me/albums?fields=name, cover_photo, count
and /{album-id}/photos?fields=id, images
Java:
Bundle parameters = new Bundle();
parameters.putString("fields", "id, images");
Bundle parameters = new Bundle();
parameters.putString("fields", "name, cover_photo, count");
https://developers.facebook.com/docs/apps/changelog#v2_4
Search for "Declarative Fields" in the changelog, you have to specify the fields you want to get returned.