我正在尝试使用图谱API获取相册的Cover Photo。
这是我的代码:
Bundle params = new Bundle();
params.putString("type", "thumbnail");
/* make the API call */
new GraphRequest(
AccessToken.getCurrentAccessToken(),
"/" + albumID + "/picture",
params,
HttpMethod.GET,
new GraphRequest.Callback() {
public void onCompleted(GraphResponse response) {
/* handle the result */
Log.v("TAG", "Facebook Photos response: " + response);
}
}
).executeAsync();
使用上面的代码,我得到了以下回复:
{Response: responseCode: 200, graphObject: {"FACEBOOK_NON_JSON_RESULT":"����\u0000\u0010JFIF\u0000\u0001\u0002\u0000\u0000\u0001\u0000\u0001\u0000\u0000��\u0000�Photoshop"}, error: null}
任何人都可以帮我解决我的请求有什么问题,以及如何获得相册的封面照片?
提前致谢。
答案 0 :(得分:0)
谷歌搜索后,我找到了一个解决方案,它对我来说很好。
我更改了 Bundle 参数,如下所示:
Bundle params = new Bundle();
params.putString("type", "thumbnail");
params.putBoolean("redirect", false);
其余的代码。 更改后,我得到了与Graph API浏览器相同的正确响应:
{Response: responseCode: 200, graphObject: {"data":{"is_silhouette":false,"url":"https:\/\/scontent.xx.fbcdn.net\/v\/t1.0-0\/s180x540\/13782019_1735895746671060_1058868038400371031_n.jpg?_nc_cat=0&oh=506c19df47791a4b7fcfc362eeed0676&oe=5B92AA68"}}, error: null}