0
我想採取Facebook的張貼圖像的Url。我成功地張貼在Facebook上照片與logInWithPublishPermissions但我想在回調後圖像的鏈接或URL ....如何獲得分享(張貼)照片URL或鏈接Facebook的SDK?
SharePhoto photo = new SharePhoto.Builder()
.setBitmap(bitmap)
.setCaption("VodaFone Rakshavandhan!")
.build();
SharePhotoContent content = new SharePhotoContent.Builder()
.addPhoto(photo)
.build();
ShareDialog shareDialog = new ShareDialog(FacebookShareActivity.this);
shareDialog.show(content, ShareDialog.Mode.AUTOMATIC);
shareDialog.registerCallback(callbackManager, new FacebookCallback<Sharer.Result>() {
@Override
public void onSuccess(Sharer.Result result) {
Log.e("@@@result", String.valueOf(result));
/* "/"+mFBID+"_"+postid+"?fields=link,message",*/
String postid=result.getPostId().toString();
mUrlFb="https://www.facebook.com/photo.php?fbid="+postid;
Log.e("@@@mUrlFb",mUrlFb);
GraphRequest request = new GraphRequest(
accessToken,
"/"+mFBID+"_"+postid,
null,
HttpMethod.GET,
new GraphRequest.Callback() {
public void onCompleted(GraphResponse response) {
Log.e("@@response", String.valueOf(response));
}
});
Bundle parameters = new Bundle();
parameters.putString("fields", "id,link,message");
request.setParameters(parameters);
request.executeAsync();
/* new GraphRequest(
AccessToken.getCurrentAccessToken(),
result.getPostId(),
null,
HttpMethod.GET,
new GraphRequest.Callback() {
public void onCompleted(GraphResponse response) {
Log.e("@@response", String.valueOf(response));
}
}
).executeAsync();*/
}
@Override
public void onCancel() {
}
@Override
public void onError(FacebookException e) {
e.printStackTrace();
}
});
我正在從這個圖表請求的響應
{Response: responseCode: 200, graphObject:
{"id":"104752556880730_105851436770842"}, error: null}
任何幫助欣賞。
你需要採取帖子ID,你的反應得到的,並且API請求使用作出這樣的,請求'permalink_url'該帖子的字段。 – CBroe
仔細閱讀[this](https://developers.facebook.com/docs/graph-api/reference/photo)一小段,有一個名爲「link」的字段 - Facebook上的照片鏈接 –
@CBroe謝謝主席先生,這很好。我傳遞了請求中唯一的permalink_url,它會回覆我,我再次感謝。 –