簡體   English   中英

如何使用Facebook Graph API中的GraphRequest從album_id獲取所有相冊照片?

[英]How to Fetch all the albums photos from album_id using GraphRequest in Facebook Graph API?

這是以下代碼的JSON格式

"albums": {
"data": [
  {
    "created_time": "2013-06-08T14:43:51+0000",
    "name": "Profile Pictures",
    "id": "1378810178998660"
  }

//碼

GraphRequest request = GraphRequest.newMeRequest(
            loginResult.getAccessToken(),new GraphRequest.GraphJSONObjectCallback() {
                @Override
                public void onCompleted(JSONObject object, GraphResponse response) {

                    if(response!=null) {
                        final JSONObject jsonObject = response.getJSONObject();

                        try {

                            final JSONObject json_album = jsonObject.getJSONObject("albums");
                            final JSONArray jarray_album = json_album.getJSONArray("data");
                            final JSONObject j_data = jarray_album.getJSONObject(0);
                            final String id = j_data.getString("id");

                        } catch (JSONException e) {
                            e.printStackTrace();
                        }
                    }
                }
            });
    Bundle parameters = new Bundle();
    parameters.putString("fields","albums");
    //location,picture,education,hometown,interested_in,political,education,locale,age_range,is_verified,photo,relationship_status
    request.setParameters(parameters);
    request.executeAsync();

因此,我將只能獲取專輯ID,而無法獲取與該專輯相關的照片,那么我該怎么辦?

您應該獲取<album-id>/photos ,但是我不知道如何使用您正在使用的Framework解決此問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM