Skip to content Skip to sidebar Skip to footer

Getting All The Photos In A User's Profile Using Facebook Sdk On Android

I'm able to get profile photo of a user using Facebook SDK 4.0 on android using this - loginButton = (LoginButton)findViewById(R.id.login_button); profile = (ImageView)fin

Solution 1:

Firstly Make sure the AccessToken has user_photos permission

Then on the app, call a GraphRequest with a photos{link} field

GraphRequest request = GraphRequest.newMeRequest(
                            AccessToken.getCurrentAccessToken(),
                            newGraphRequest.GraphJSONObjectCallback() {
                                @OverridepublicvoidonCompleted(
                                        JSONObject object,
                                        GraphResponse response) {
                                    try {
                                        //This contains all the photos with array data>>link JSONObject photosobject = object.getJSONObject("photos");




                                    } catch (Exception e) {
                                        e.printStackTrace();
                                    }
                                }
                            });
    Bundle parameters = newBundle();
                    parameters.putString("fields", "id,name,picture,photos{link}");
                    request.setParameters(parameters);
                    request.executeAsync();

Then please refer to the Facebook Graph API tool to test the values you want https://developers.facebook.com/tools/explorer/145634995501895/?method=GET&path=me%3Ffields%3Dphotos%7Blink%7D

Note: also make sure that you have the latest FacebookSDK

Post a Comment for "Getting All The Photos In A User's Profile Using Facebook Sdk On Android"