thank you for your time and help.
I am trying to get all the profile pictures of the current user , but I am getting a weird answer :
{Response: responseCode:200, graphObject: GraphObject{graphObjectClass=GraphObject, state={"data":[]}}, error: null, isFromCache: false}
I have already made the authentification and loaded some other informations successfully.
I have already checked some other similar questions/answers and I didn't find anyone working with fql and the new API of facebook.
The permissions are defined like this:
/**
* the list of permissions of facebook
* */
private static final List<String> FACEBOOK_PERMISSION_LIST = Arrays.asList(
"user_photos", "email", "user_birthday", "basic_info");
The code
String fqlQuery = "SELECT src_big FROM photo WHERE album_object_id IN (SELECT object_id FROM album WHERE owner = me() AND name='Profile Pictrue' AND type='profile' )";
Bundle params = new Bundle();
params.putString("q", fqlQuery);
Session session = Session.getActiveSession();
Request request = new Request(session, "/fql",
params, HttpMethod.GET,
new Request.Callback() {
public void onCompleted(
Response response) {
Log.i(TAG, "Got results: "
+ response.toString());
}
});
Request.executeBatchAsync(request);
I hope you can help me, every suggestion is welcome.
There's a typo in name='Profile Pictrue'
; it's name='Profile Pictures'
(But the thing is that you dont need to check for this name
, type=profile
is just enough.)
So your final query should be:
SELECT src_big
FROM photo
WHERE album_object_id IN (
SELECT object_id
FROM album
WHERE owner = me()
AND type='profile'
)
or better (because it was not possible to query by type for me):
String fqlQuery = "SELECT src_big FROM photo WHERE album_object_id IN (SELECT object_id FROM album WHERE owner = me() AND (type='profile' OR name='Profile Pictures'))";
And adding some parameters to the request, which will look like this:
Bundle params = new Bundle();
params.putString("q", fqlQuery);
params.putString("format", "json");
params.putString("query", fqlQuery);
params.putString("access_token", fbAccessToken);
Session session = Session.getActiveSession();
Request request = new Request(session, "/fql", params, HttpMethod.GET, new Request.Callback() {
public void onCompleted(Response response) {
Log.i(TAG, "Got results: " + response.toString());
}
});
Request.executeBatchAsync(request);