是否有任何其他/简单的方法来获取我的 facebook 相册中的照片。 我使用以下方式从相册中获取照片。 有没有办法通过编码/编程方式获取访问 token ?现在写我从浏览器中获取它......
获取访问 token :
http://developers.facebook.com/tools/explorer/?method=GET&path=223643860987514%2Fphotos
获取专辑ID:
https://graph.facebook.com/me/albums?access_token=
从特定相册中获取照片:
https://graph.facebook.com/223643860987514/photos?access_token=
提前致谢......
最佳答案
要从当前的 Facebook SDK (4) 中检索相册,您可以这样做:
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();
该示例检索个人资料图片相册。获取此相册后,您可以使用相册 ID 检索图片。
关于android - 在 android/java 中获取我的 facebook 相册照片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7454284/