【发布时间】:2016-01-07 18:32:24
【问题描述】:
我们可以使用 garph API {user-id}/albums 获取 facebook 相册详细信息
/*make API call*/
new GraphRequest(
AccessToken.getCurrentAccessToken(), //your fb AccessToken
"/" + AccessToken.getCurrentAccessToken().getUserId() + "/albums",//user id of login user
null,
HttpMethod.GET,
new GraphRequest.Callback() {
public void onCompleted(final GraphResponse response) {
}
}).executeAsync();
现在我需要获取这些专辑的封面照片,我知道使用 garph API {albums-id}/picture 我们可以做到这一点。如下所示
Bundle params = new Bundle();
params.putString("type", "small"); //You use this to get a pre-specified size of picture.
params.putBoolean("redirect", false);
new GraphRequest(
AccessToken.getCurrentAccessToken(),
"/" + id + "/picture",
params,
HttpMethod.GET,
new GraphRequest.Callback() {
public void onCompleted(GraphResponse response) {
}
}).executeAsync();
但我们需要对其进行不同的 API 调用。有没有办法获取专辑封面照片以及专辑详细信息?
而且我得到的封面照片质量也降低了。
我已经尝试过来自here的所有类型
type : enum{thumbnail,small,album}
【问题讨论】:
-
/me/albums?fields=picture– developers.facebook.com/docs/graph-api/using-graph-api/#fields -
谢谢CBroe,你拯救了我的一天。
-
你在 onComplete 中做什么?我正在尝试获取照片 url 源,但在 onComplete 方法中找不到任何帮助。
-
将相册 ID 传递给照片 API,如下所示 pastebin.com/GNjTdEkx
标签: android facebook facebook-graph-api