Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/218.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/list/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在android中获取fb用户照片?_Android_Facebook_Facebook Graph Api - Fatal编程技术网

如何在android中获取fb用户照片?

如何在android中获取fb用户照片?,android,facebook,facebook-graph-api,Android,Facebook,Facebook Graph Api,我尝试通过以下方式通过GraphRequest检索facebook用户照片 代码: 你能告诉我如何获取fb用户照片吗?你要求从Facebook帐户获取照片。在搜索了数小时Facebook开发者页面后,我找到了你问题的解决方案,我提供了获取Facebook用户照片的链接,请关注 链接: 您是否向用户请求查看其相册所需的权限…?我不知道如何要求用户接受权限,尤其是访问photosWell的权限,然后从这里开始:您需要什么权限,您可以在上面的链接下找到,它需要用户\u照片权限和发布\u操作权限,但是

我尝试通过以下方式通过GraphRequest检索facebook用户照片 代码:


你能告诉我如何获取fb用户照片吗?

你要求从Facebook帐户
获取照片。在搜索了数小时Facebook开发者页面后,我找到了你问题的解决方案,我提供了获取Facebook用户照片的链接,请关注
链接:


您是否向用户请求查看其相册所需的权限…?我不知道如何要求用户接受权限,尤其是访问photosWell的权限,然后从这里开始:您需要什么权限,您可以在上面的链接下找到,它需要用户\u照片权限和发布\u操作权限,但是它没有关于如何授予权限的信息,先生……第一个链接所做的只是解释你如何向用户请求权限……回答得很好,但是如何按日期将图像按顺序排列??最近50次
enter code here  final ArrayList[] alFBAlbum = new ArrayList[]{new ArrayList<>()};

/*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(GraphResponse response) {
                    Log.d("fb_album_response", "Facebook Albums: " + response.toString());
                    try {
                        if (response.getError() == null) {
                            JSONObject joMain = response.getJSONObject(); //convert GraphResponse response to JSONObject
                            if (joMain.has("data")) {
                                JSONArray jaData = joMain.optJSONArray("data"); //find JSONArray from JSONObject
                                alFBAlbum[0] = new ArrayList<>();
                                for (int i = 0; i < jaData.length(); i++) {//find no. of album using jaData.length()
                                    JSONObject joAlbum = jaData.getJSONObject(i);
                                    String my_id=joAlbum.optString("id");//convert perticular album into JSONObject
                                    Log.d("my_facebook_id",my_id);
                                    GetFacebookImages(my_id); //find Album ID and get All Images from album
                                }
                            }
                        } else {
                            Log.d("Test",response.getError().toString());
                        }
                    } catch (JSONException e) {
                        e.printStackTrace();
                    }
                }
            }

    ).executeAsync();
enter code here  {
  "data":[]
 }, 
   error: null
  }
/* make the API call */
Bundle params  = new Bundle();
bundle.putExtra("fields","images");

new GraphRequest(
AccessToken.getCurrentAccessToken(),
"/"+"USER ID"+"/photos",
params,
HttpMethod.GET,
new GraphRequest.Callback() {
    public void onCompleted(GraphResponse response) {
        /* handle the result */
         /* You can parse this response using Json  */
    }
}
).executeAsync();