How to add user_photos permission to get Facebook album photos in Android?… here is a solution to the problem.
How to add user_photos permission to get Facebook album photos in Android?
I’m using the Facebook Android SDK to access a user’s Facebook album and an intern to get photos.
But when I execute “https://graph.facebook.com/" +wallAlbumID+"/photos?access_token="+facebook.getAccessToken(),
it returns blank data. {"data":[]}
I read in stackoverflow question Alsoin Graph API for Photo, I need to grant user_photos
when creating a facebook object Permissions.
I don’t know how to do it. I read a lot of forums and looked at the SOFs but couldn’t find a solution.
This is how I created the Facebook object
facebook = new Facebook(APP_ID);
Can anyone help me with this.
Solution
You need to create an ArrayList
for the permissions you want to access. For example, when I do it, when I declare variables.
private static final String[] PERMISSIONS = { "user_photos" };
Then, when implementing the user login area:
if (!facebook.isSessionValid()) {
facebook.authorize(this, PERMISSIONS, new LoginDialogListener());
}
Hope this helps!