0

I have downloaded facebook-android-sdk-3.14.1.zip and am trying to get the examples working. I get stuck on the FriendPickerFragment that never returns a list of friends. I can log onto Facebook ok (again using the Facebook code), both using the 'Scrumptious' example and my version of it by followiing https://developers.facebook.com/docs/android/getting-started

I found that my requests were only going with public profile permission e.g.

{Session state:OPENED, token:{AccessToken token:ACCESS_TOKEN_REMOVED permissions:[public_profile]}, appId:520510648055719}

I took code from Facebook friend picker SDK sample not working Android, that would add the user_friends permission and see that Session was now:

{Session state:OPENED, token:{AccessToken token:ACCESS_TOKEN_REMOVED permissions:[public_profile, basic_info, user_friends]}, appId:520510648055719}

When I traced the code down to RequestAsyncTask.doInBackground the values of requests in :

@Override
protected List<Response> doInBackground(Void... params) {
    try {
        if (connection == null) {
            return requests.executeAndWait();
        } else {
            return Request.executeConnectionAndWait(connection, requests);
        }
    } catch (Exception e) {
        exception = e;
        return null;
    }
}

is

{Request:  session: {Session state:OPENED, token:{AccessToken    token:ACCESS_TOKEN_REMOVED permissions:[public_profile, basic_info, user_friends]}, appId:520510648055719}, graphPath: me/friends, graphObject: null, restMethod: null, httpMethod: GET, parameters: Bundle[{fields=id,name,picture.height(75).width(75)}]}

and I see as a response in onPostExecute(List result) :

 [{Response:  responseCode: 200, graphObject: GraphObject{graphObjectClass=GraphObject, state={"data":[]}}, error: null, isFromCache:true}]

Could there have been some caching problem earlier that I need to clear first? If so how do I do that?

I have read that Facebook has changed security recently. I have create my Facebook TestUI 'app' and entered the hashKey (I assume all is ok as I can log into Facebook successfully)

Is there something else I should be looking at?

Looking for any and all wisdom on this.

Thanks

Eric

Community
  • 1
  • 1
Eric
  • 781
  • 1
  • 10
  • 18
  • Please search on stackoverflow. You are most likely using API v2.0 which means that you will only get back friends that are also using the app – WizKid May 21 '14 at 22:11

1 Answers1

1

With Graph Search v2.0, requests for a user's friends will only return a list of friends that also use your app (including the samples), and the user_friends permission must be requested as a special permission. There doesn't appear to be a true way around this, though you can search for things like "taggable_friends" using something like:

    new Request(
    session,
    "/me/taggable_friends", //instead of "/me/friends"
    null,
    HttpMethod.GET,
    new Request.Callback() {
        public void onCompleted(Response response) {
            /* handle the result */
        }
    }).executeAsync();

from Facebook Graph Reference.

MarmotXing
  • 132
  • 8
  • My app records distance covered during and exercise (walking, hiking, biking, etc.) with some statistics. I wanted the app to post the stats to the persons timeline and have friends see it. As I understand your and Whizkid's comments, I will only get a list of friends that also have the app. Is that correct? – Eric May 22 '14 at 12:18
  • That is correct. You can, however, search for "taggable_friends," and that should return a list of friends that allow you to tag them in status (at least in theory, Facebook generates unreliable documentation that goes out of date very quickly). – MarmotXing May 22 '14 at 14:06