Skip to content Skip to sidebar Skip to footer

Android Facebook Sdk How To Get All Friends List Who Installed My App

i succeeded to get friends who installed my app BUT i have a case which is that some friends who already installed my app ,I could not find them when i request to get the list of

Solution 1:

Try this. Please make sure your read permissions include user_friends as follows

loginButton.setReadPermissions("email", "public_profile","user_friends");
        loginButton.registerCallback(mCallbackManager, newFacebookCallback<LoginResult>() {
            @OverridepublicvoidonSuccess(LoginResult loginResult) {
                Log.d(TAG, "facebook:onSuccess:" + loginResult);

            }

            @OverridepublicvoidonCancel() {
                Log.d(TAG, "facebook:onCancel");
            }

            @OverridepublicvoidonError(FacebookException error) {
                Log.d(TAG, "facebook:onError", error);
            }
        });

Then get friends like this

GraphRequestrequest= GraphRequest.newMyFriendsRequest(AccessToken.getCurrentAccessToken(), newGraphRequest.GraphJSONArrayCallback() {
                                    @OverridepublicvoidonCompleted(JSONArray jsonArray, GraphResponse graphResponse) {

}
});

or by get request

String urll="https://graph.facebook.com/v2.7/me/friends?access_token="+ user accesstoken;

Refer:- https://coderzpassion.com/android-using-facebook-login-application-using-latest-facebook-sdk/

Post a Comment for "Android Facebook Sdk How To Get All Friends List Who Installed My App"