Not able to fetch FB friends using SocialService::getFacebookFriendsFromLinkUser api

0 votes

Please refer the following steps:

1. I have logged in to facebook using my android app with "Facebook Login Button" as described at "https://developers.facebook.com/docs/android/login-with-facebook/v2.0". 

2. Following facebook read permissions are granted to my app successfuly during this login.

"authButton.setReadPermissions(Arrays.asList("email", "read_friendlists", "friends_birthday", "friends_location"));"

3. socialService.getFacebookProfile(accessToken) -- returns correctly with profile details

4. socialService.linkUserFacebookAccount(currentUserName, accessToken, appID, secret) or 

socialService.linkUserFacebookAccount(currentUserName, accessToken) -- returns success

5. socialService.getFacebookFriendsFromLinkUser(userName) or socialService.getFacebookFriendsFromAccessToken(accessToken) returns empty friend list. No exception/error is thrown..!!!!

asked May 28, 2014 in App42 Cloud API-BaaS by Sahil Gera (20 points)

1 Answer

0 votes
Hi Sahil,

Can you share the logs with us that will more helpful to debug the issue.
answered May 28, 2014 by hs00105 (517 points)
Please find the logs below. Is there any additional step that I am missing apart from those mentioned above? Do we need some additional fb permissions to get friend list? Or, are there any other security requirements for SocialService::getFacebookFriendsFromLinkUser api?

Logs:
05-29 17:59:01.322: D/ActivityThread(4194): handleBindApplication:com.example.groupchattest
05-29 17:59:01.342: D/ActivityThread(4194): setTargetHeapUtilization:0.25
05-29 17:59:01.342: D/ActivityThread(4194): setTargetHeapMinFree:524288
05-29 17:59:01.422: W/ActivityThread(4194): Application com.example.groupchattest is waiting for the debugger on port 8100...
05-29 17:59:01.432: I/System.out(4194): Sending WAIT chunk
05-29 17:59:01.442: I/dalvikvm(4194): Debugger is active
05-29 17:59:01.662: I/System.out(4194): Debugger has connected
05-29 17:59:01.662: I/System.out(4194): waiting for debugger to settle...
05-29 17:59:01.863: I/System.out(4194): waiting for debugger to settle...
05-29 17:59:02.063: I/System.out(4194): waiting for debugger to settle...
05-29 17:59:02.273: I/System.out(4194): waiting for debugger to settle...
05-29 17:59:02.473: I/System.out(4194): waiting for debugger to settle...
05-29 17:59:02.673: I/System.out(4194): waiting for debugger to settle...
05-29 17:59:02.884: I/System.out(4194): waiting for debugger to settle...
05-29 17:59:03.084: I/System.out(4194): debugger has settled (1417)
05-29 17:59:03.244: I/System.out(4194): Installation.getSession : /data/data/com.example.groupchattest/files/SESSION: open failed: ENOENT (No such file or directory)
05-29 17:59:03.254: I/System.out(4194): Installation.getUser : /data/data/com.example.groupchattest/files/USER: open failed: ENOENT (No such file or directory)
05-29 17:59:03.775: E/Hash key(4194): NUzCs+JPRQrHFwI8avvuqqj792I=
05-29 17:59:04.635: I/Adreno200-EGL(4194): <qeglDrvAPI_eglInitialize:269>: EGL 1.4 QUALCOMM build:

AU_LINUX_ANDROID_JB_VANILLA.04.02.02.60.051_msm8960_JB_VANILLA_CL2997615_release_AU (CL2997615)
05-29 17:59:04.635: I/Adreno200-EGL(4194): Build Date: 04/11/13 Thu
05-29 17:59:04.635: I/Adreno200-EGL(4194): Local Branch:
05-29 17:59:04.635: I/Adreno200-EGL(4194): Remote Branch: quic/mako_jb_mr1
05-29 17:59:04.635: I/Adreno200-EGL(4194): Local Patches: NONE
05-29 17:59:04.635: I/Adreno200-EGL(4194): Reconstruct Branch: AU_LINUX_ANDROID_JB_VANILLA.04.02.02.60.051 +  NOTHING
05-29 17:59:04.665: D/Request(4194): Warning: Sessionless Request needs token but missing either application ID or client token.
05-29 17:59:04.705: D/OpenGLRenderer(4194): Enabling debug mode 0
05-29 17:59:05.176: I/ActivityManager(4194): Timeline: Activity_idle id: android.os.BinderProxy@417c8f10 time:214939
05-29 17:59:05.306: D/Request(4194): Warning: Sessionless Request needs token but missing either application ID or client token.
05-29 17:59:14.255: I/ActivityManager(4194): Timeline: Activity_launch_request id:com.example.groupchattest time:224016
05-29 17:59:18.429: I/ActivityManager(4194): Timeline: Activity_idle id: android.os.BinderProxy@41805688 time:228184
05-29 17:59:20.621: I/ActivityManager(4194): Timeline: Activity_launch_request id:com.facebook.katana time:230374
05-29 17:59:39.009: I/Choreographer(4194): Skipped 410 frames!  The application may be doing too much work on its main thread.
05-29 17:59:41.682: I/Choreographer(4194): Skipped 151 frames!  The application may be doing too much work on its main thread.
05-29 17:59:41.802: I/ActivityManager(4194): Timeline: Activity_idle id: android.os.BinderProxy@417c8f10 time:251566
05-29 17:59:46.787: I/System.out(4194): JSon Here : {"app42":{"response":{"success":true,"social":

{"facebookAccessToken":"CAAKSXj0sYjIBADLMV8yacZAqQkI3sN7uHnqtQBD6U9NjnXrMMvdSZCdINQjeZAjvI2V7dIwCQdW5aUIrjZAbtK0tnkB9D7GWppEfu9WOa1KbUdLhA8Dwutb4X6YCIDofbTqD8lOXDVi

ow4yAb10oZAOvYjTVBLZBTmYd0ORnwzM83bD3XIonmtlA6tQWJr6IZCGdRKWKFZAKokr7dlOWKt","me":{"id":"10152392386589020","name":"Sahil Gera","picture":"https://fbcdn-profile-

a.akamaihd.net/hprofile-ak-xpa1/t1.0-1/c182.12.621.621/s50x50/69434_10151517723139020_1016635957_n.jpg","email":"catchme.sahil@gmail.com"}}}}}
05-29 17:59:49.609: I/System.out(4194): JSon Here : {"app42":{"response":{"success":true,"social":

{"facebookAccessToken":"CAAKSXj0sYjIBADLMV8yacZAqQkI3sN7uHnqtQBD6U9NjnXrMMvdSZCdINQjeZAjvI2V7dIwCQdW5aUIrjZAbtK0tnkB9D7GWppEfu9WOa1KbUdLhA8Dwutb4X6YCIDofbTqD8lOXDVi

ow4yAb10oZAOvYjTVBLZBTmYd0ORnwzM83bD3XIonmtlA6tQWJr6IZCGdRKWKFZAKokr7dlOWKt","me":{"id":"10152392386589020","name":"Sahil Gera","picture":"https://fbcdn-profile-

a.akamaihd.net/hprofile-ak-xpa1/t1.0-1/c182.12.621.621/s50x50/69434_10151517723139020_1016635957_n.jpg","email":"catchme.sahil@gmail.com"}}}}}
05-29 17:59:49.910: D/dalvikvm(4194): threadid=18: still suspended after undo (sc=1 dc=1)
05-29 17:59:51.141: D/dalvikvm(4194): threadid=18: still suspended after undo (sc=1 dc=1)
05-29 17:59:51.831: D/dalvikvm(4194): threadid=17: still suspended after undo (sc=1 dc=1)
05-29 17:59:52.842: D/dalvikvm(4194): threadid=18: still suspended after undo (sc=1 dc=1)
05-29 17:59:52.862: D/dalvikvm(4194): threadid=18: still suspended after undo (sc=1 dc=1)
05-29 17:59:53.353: D/dalvikvm(4194): threadid=18: still suspended after undo (sc=1 dc=1)
05-29 17:59:54.924: D/dalvikvm(4194): threadid=18: still suspended after undo (sc=1 dc=1)
05-29 17:59:54.954: I/System.out(4194): facebookProfileId is : 10152392386589020
05-29 17:59:54.974: D/dalvikvm(4194): threadid=18: still suspended after undo (sc=1 dc=1)
05-29 17:59:55.005: I/System.out(4194): facebookProfileName is : Sahil Gera
05-29 17:59:55.005: I/System.out(4194): facebookProfileImage is : https://fbcdn-profile-a.akamaihd.net/hprofile-ak-xpa1/t1.0-1/c182.12.621.621/s50x50/69434_10151517723139020_1016635957_n.jpg
05-29 17:59:57.227: I/System.out(4194): JSon Here : {"app42":{"response":{"success":true,"social":{"userName":"Sahil

Gera","facebookAppId":"723883404321330","facebookAppSecret":"aec176cf99d319204ef602fc8a0d351e","facebookAccessToken":"CAAKSXj0sYjIBADLMV8yacZAqQkI3sN7uHnqtQBD6U9NjnXrMMvdSZC

dINQjeZAjvI2V7dIwCQdW5aUIrjZAbtK0tnkB9D7GWppEfu9WOa1KbUdLhA8Dwutb4X6YCIDofbTqD8lOXDViow4yAb10oZAOvYjTVBLZBTmYd0ORnwzM83bD3XIonmtlA6tQWJr6IZCGdRKWKFZAKokr7dlOWK

t"}}}}
05-29 17:59:57.247: I/System.out(4194): userName is Sahil Gera
05-29 17:59:57.557: D/dalvikvm(4194): threadid=19: still suspended after undo (sc=1 dc=1)
05-29 17:59:58.148: D/dalvikvm(4194): threadid=18: still suspended after undo (sc=1 dc=1)
05-29 17:59:58.628: D/dalvikvm(4194): threadid=19: still suspended after undo (sc=1 dc=1)
05-29 17:59:58.638: I/System.out(4194): facebookProfileId is : 10152392386589020
05-29 17:59:58.638: I/System.out(4194): facebookProfileName is : Sahil Gera
05-29 17:59:58.638: I/System.out(4194): facebookProfileImage is : https://fbcdn-profile-a.akamaihd.net/hprofile-ak-xpa1/t1.0-1/c182.12.621.621/s50x50/69434_10151517723139020_1016635957_n.jpg
05-29 18:00:02.802: I/System.out(4194): JSon Here : {"app42":{"response":{"success":true,"social":{"userName":"Sahil

Gera","facebookAppId":"723883404321330","facebookAppSecret":"aec176cf99d319204ef602fc8a0d351e","facebookAccessToken":"CAAKSXj0sYjIBADLMV8yacZAqQkI3sN7uHnqtQBD6U9NjnXrMMvdSZC

dINQjeZAjvI2V7dIwCQdW5aUIrjZAbtK0tnkB9D7GWppEfu9WOa1KbUdLhA8Dwutb4X6YCIDofbTqD8lOXDViow4yAb10oZAOvYjTVBLZBTmYd0ORnwzM83bD3XIonmtlA6tQWJr6IZCGdRKWKFZAKokr7dlOWK

t"}}}}
05-29 18:00:02.822: I/System.out(4194): userName is Sahil Gera
05-29 18:00:04.053: I/System.out(4194): JSon Here : {"app42":{"response":{"success":true,"social":{"userName":"Sahil Gera"}}}}
05-29 18:00:04.884: D/dalvikvm(4194): threadid=18: still suspended after undo (sc=1 dc=1)
05-29 18:00:07.617: I/System.out(4194): JSon Here : {"app42":{"response":{"success":true,"social":{"userName":"Sahil Gera"}}}}
05-29 18:00:07.967: D/dalvikvm(4194): threadid=19: still suspended after undo (sc=1 dc=1)
05-29 18:00:13.202: D/dalvikvm(4194): threadid=19: still suspended after undo (sc=1 dc=1)
Hi Sahil,
You also need to add the permission "user_friends" from graph explorer of facebook  that will return your facebook friend list. It will appear on 1.0 version in graph explorer.
Please find the link below :-
https://www.facebook.com/login.php?next=https%3A%2F%2Fdevelopers.facebook.com%2Ftools%2Fexplorer%2F145634995501895%2F
Hi Himanshu,

On adding "user_friends" permission too, SocialService::getFacebookFriendsFromLinkUser api does not return friend list.
Hi Sahil,
Please select the version 1.0 from facebook graph explorer.
Hi Himanshu,

http://stackoverflow.com/questions/23400204/get-facebook-friends-with-graph-api-v-2-0
Apps created on or after April 30th 2014 must use Graph API v2.0; they're not able to call Graph API v1.0. Therefore, I can only use Graph API v2.0 and able to fetch friend list only via "/me/taggable_friends" graph explorer API.

In order to accommodate this recent change by facebook, AppCloud42 api "getFacebookFriendsFromLinkUser " should be modified accordingly. This currently does not return friend list due to the above reason.
Hello,
Please find the blog post which help you to find the friend list of your facebook friends. By using this feature you don't need to integrate the Facebook sdk for Facebook login.
http://blogs.shephertz.com/2014/07/23/empower-app42-unity-app-with-facebook-auth/
Let us know if it helps.
Hi Himanshu,

The link provided contains a project to be imported in Unity. I am not using Unity as I am not using App42 to develop a game.
Does this work with Eclipse also (without much change)?
Could you please let me know in which platform and sdk version you are working on? So that i can assist a better support to you.
Thanks
Eclipse ADT.. Android SDK 23.. Target Android API 19..
Hello Sahil,

Please have a look on below post to integrate the Facebook in your android app.
http://blogs.shephertz.com/2013/07/16/how-to-integrate-facebook-in-your-android-app/#more-1655
Let us know if it helps.
Thanks.
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...