I want to take Url of Facebook post image. I am successfully posting the photo on Facebook with the logInWithPublishPermissions but I want the link or Url of the post image in call back....
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();
}
});
I am getting the Response from this Graph Request
{Response: responseCode: 200, graphObject:
{"id":"104752556880730_105851436770842"}, error: null}
any help appreciate.
Special Thanks to @CBroe
Only Add the parameter **permalink_url**
parameters.putString("fields", "id,link,message,permalink_url");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.