在Android中如何添加user_photos权限来获取Facebook相册的照片?权限、照片、相册、Android

2023-09-07 12:53:52 作者:少喝点酒

我使用的是Facebook的Andr​​oid SDK中访问该用户的Facebook相册和实习获得的照片。 但是,当我做了"https://graph.facebook.com/"+wallAlbumID+"/photos?access_token="+facebook.getAccessToken()它返回空白数据。 {数据:[]}

I am using the facebook android sdk to access the user's facebook albums and intern get the photos. But when I do a "https://graph.facebook.com/"+wallAlbumID+"/photos?access_token="+facebook.getAccessToken() it returns blank data. { "data": [] }

我看了在计算器问题也的在图形API的照片的,我需要给 user_photos 在创建Facebook的对象权限。 我不知道该怎么办so.I看了很多论坛,并检查了特种作战部队,但无法找到解决办法。

I read in stackoverflow question and also in Graph API for Photo that I need to give user_photospermission while creating the facebook object. I am not sure how to do so.I read a lot of forums and also checked on SOF but could not find the solution.

这是我如何创建一个Facebook对象

This is how I am creating the facebook object

facebook = new Facebook(APP_ID);

任何人都可以请帮我这。

Can anyone please help me with this.

推荐答案

您需要创建一个 ArrayList的要访问的权限。例如,当我做到了,声明变量的时候。

You need to create an ArrayList of permissions you want to access. For example, when I did it, when declaring 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!

 
精彩推荐