【发布时间】:2017-04-19 11:20:38
【问题描述】:
我正在使用 Facebook 的 ShareDialog,以便在我的应用程序中的 Facebook 上共享 printScreen 图像。
安装 Facebook 应用后,它可以正常工作。
当 Facebook 应用未安装时,它不起作用。我看到“加载”屏幕,然后它消失了,没有任何反应。 分享对话框对象到达带有 FacebookException 的 onError 回调:
{FacebookGraphResponseException: (#200) Requires extended permission: publish_actions httpResponseCode: 403, facebookErrorCode: 200, facebookErrorType: OAuthException, message: (#200) Requires extended permission: publish_actions}
那么我真的需要“publish_actions”权限仅用于 facebook 网络而不是 facebook 应用程序吗?奇怪..
Facebook writes:
https://developers.facebook.com/docs/sharing/android
"If the Facebook app is not installed it will automatically fallback to the web-based dialog"
"Now the SDK automatically checks for the native Facebook app. If it isn't installed, the SDK switches people to their default browser and opens the Feed Dialog."
我的代码:
mShareDialog = new ShareDialog(mActivity);
mShareDialog.registerCallback(callbackManager, new FacebookCallback<Sharer.Result>() {
@Override
public void onSuccess(Sharer.Result result) {}
@Override
public void onCancel() {}
@Override
public void onError(FacebookException error) {
if (error != null) {
showDialog("facebook app isn't installed");
}
}
});
if (ShareDialog.canShow(ShareLinkContent.class)) {
// get a screenshot
Bitmap image = getScreenshot();
SharePhoto photo = new SharePhoto.Builder()
.setBitmap(image)
.setCaption(getResources().getString(R.string.shareBodyText))
.build();
SharePhotoContent content = new SharePhotoContent.Builder()
.addPhoto(photo)
.build();
mShareDialog.show(content);
}
那么为什么在没有“publish_actions”的情况下安装 facebook 应用程序时它可以工作,而在没有安装 facebook 应用程序时它不能工作?
【问题讨论】:
标签: android facebook-graph-api facebook-sharer facebook-share publish-actions