1
votes

is there any other/easy way to get the my facebook albums photos . i have used the following way to get the photos from album. is there any way to get access token through coding/programetically? write now i get it from browser......

to get Access Token:

http://developers.facebook.com/tools/explorer/?method=GET&path=223643860987514%2Fphotos

to get album id:

https://graph.facebook.com/me/albums?access_token=

to get photo from perticular album:

https://graph.facebook.com/223643860987514/photos?access_token=

Thanks in advance.......

1
thanks for your comment , try to improve it - Hiren Dabhi
each time you have commit for improvement but not. why? - Nikunj Patel
actually i don't before you have comments that if response from other users and is useful for me than accept it..... - Hiren Dabhi
but without improving, user will dislike to give answer - Nikunj Patel
Ok Thanks for your suggestion. from now onwords i'll take care of it and if any post/things that are useful for others than definitely ask the question and solution for that... - Hiren Dabhi

1 Answers

1
votes

To retrieve albums from the current Facebook SDK (4) you can do this:

   new GraphRequest(
            AccessToken.getCurrentAccessToken(),
            "/me/albums",
            null,
            HttpMethod.GET,
            new GraphRequest.Callback() {
                public void onCompleted(GraphResponse response) {
                    String albumID = null;
                    try{
                        JSONObject json = response.getJSONObject();
                        JSONArray jarray = json.getJSONArray("data");
                        for(int i = 0; i < jarray.length(); i++) {
                            JSONObject oneAlbum = jarray.getJSONObject(i);
                            //get albums id
                            if (oneAlbum.getString("name").equals("Profile Pictures")) {
                                albumID = oneAlbum.getString("id");
                            }
                        }
                    }
                    catch(JSONException e){
                        e.printStackTrace();
                    }
            }
        ).execAsyncTask();

The example retrieves the profile pictures album. After you get this album you can use the album id to retrieve the pictures.