[英]Android: Why it is not possible to upload to facebook album “Profile Pictures”
[英]Get the pictures of the facebook profile album
感謝您的時間和幫助。
我正在嘗試獲取當前用戶的所有個人資料圖片,但是我得到一個奇怪的答案:
{Response: responseCode:200, graphObject: GraphObject{graphObjectClass=GraphObject, state={"data":[]}}, error: null, isFromCache: false}
我已經進行了身份驗證並成功加載了其他信息。
我已經檢查了其他一些類似的問題/答案,但沒有找到任何人使用fql和facebook的新API。
權限的定義如下:
/**
* the list of permissions of facebook
* */
private static final List<String> FACEBOOK_PERMISSION_LIST = Arrays.asList(
"user_photos", "email", "user_birthday", "basic_info");
編碼
String fqlQuery = "SELECT src_big FROM photo WHERE album_object_id IN (SELECT object_id FROM album WHERE owner = me() AND name='Profile Pictrue' AND type='profile' )";
Bundle params = new Bundle();
params.putString("q", fqlQuery);
Session session = Session.getActiveSession();
Request request = new Request(session, "/fql",
params, HttpMethod.GET,
new Request.Callback() {
public void onCompleted(
Response response) {
Log.i(TAG, "Got results: "
+ response.toString());
}
});
Request.executeBatchAsync(request);
希望您能幫到我,歡迎大家提出建議。
name='Profile Pictrue'
有一個錯字; 它的name='Profile Pictures'
(但事實是,您無需檢查此name
, type=profile
就足夠了。)
因此,您的最終查詢應為:
SELECT src_big
FROM photo
WHERE album_object_id IN (
SELECT object_id
FROM album
WHERE owner = me()
AND type='profile'
)
或更好(因為無法為我按類型查詢):
String fqlQuery = "SELECT src_big FROM photo WHERE album_object_id IN (SELECT object_id FROM album WHERE owner = me() AND (type='profile' OR name='Profile Pictures'))";
並向請求中添加一些參數,如下所示:
Bundle params = new Bundle();
params.putString("q", fqlQuery);
params.putString("format", "json");
params.putString("query", fqlQuery);
params.putString("access_token", fbAccessToken);
Session session = Session.getActiveSession();
Request request = new Request(session, "/fql", params, HttpMethod.GET, new Request.Callback() {
public void onCompleted(Response response) {
Log.i(TAG, "Got results: " + response.toString());
}
});
Request.executeBatchAsync(request);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.