我可以在Facebook的圖形API Explorer中運行,這讓用戶ID,用戶名,最近的狀態,以及個人資料圖片,如何執行圖形的API,Facebook的Android SDK中
/8794851923?fields=id,name,statuses,picture
如何使用執行,在機器人Facebook-SDK並獲得結果?我試過this,但它已被棄用。
感謝,
我可以在Facebook的圖形API Explorer中運行,這讓用戶ID,用戶名,最近的狀態,以及個人資料圖片,如何執行圖形的API,Facebook的Android SDK中
/8794851923?fields=id,name,statuses,picture
如何使用執行,在機器人Facebook-SDK並獲得結果?我試過this,但它已被棄用。
感謝,
考慮看看Facebook的樣品SDK後,我得到這個:
Bundle params = new Bundle();
params.putString("fields", "id,name,statuses");
final String requestId = "154727011315956";
Request request = new Request(session, requestId, params, HttpMethod.GET, new Request.Callback() {
public void onCompleted(Response response) {
GraphObject graphObject = response.getGraphObject();
FacebookRequestError error = response.getError();
if(error!=null){
Log.e("Error", error.getErrorMessage());
}
}
});
Request.executeAndWait(request);
的圖形API是進入和離開Facebook的 社交圖的數據的主要方式。這是一個低級的基於HTTP的API,您可以使用它來查詢數據,發佈新故事,上傳照片以及應用程序可能需要執行的各種其他 任務。本指南將教你如何在Graph API中完成所有這些事情。
/* make the API call */
new GraphRequest(
AccessToken.getCurrentAccessToken(),
"/me",
null,
HttpMethod.GET,
new GraphRequest.Callback() {
public void onCompleted(GraphResponse response) {
/* handle the result */
System.out.println("Response::" + String.valueOf(response.getJSONObject()));
}
}
).executeAsync();
這裏,
AccessToken.getCurrentAccessToken()>>登錄用戶的訪問令牌
/ME >>開發自己的個人資料信息
在這裏也適用id /用戶/頁面的名稱以獲得該信息 like:/joshuatreemusicfestival /職位/
空>>路過這裏實際得到哪種類型的用戶/頁的信息像的參數:
Bundle param = new Bundle();
param.putString("fields", "message,created_time,id,full_picture,status_type,source,comments.summary(true),likes.summary(true)");
PARAM更換空
HttpMethod.GET >>請求方法[GET,POST,DELETE]
最後onCompleted()調用得到&要響應... !!!
,如果我想要做這樣的事情: https://graph.facebook.com/me/photos 會是什麼捆綁PARAMS樣子? –
我們可以從這個 – Prasad
得到生日什麼是'Request'類的確切包?我將android facebook sdk包含到了android studio項目中,但它說'無法解析符號請求' –