爲了我的應用程序中共享在Facebook上PRINTSCREEN像我使用了Facebook的ShareDialog。Facebook的shareDialog是未安裝應用程序時 - 怪異的行爲?
當安裝Facebook應用程序,它工作正常的。
當Facebook應用程序不安裝,這是行不通的。我看到「加載」屏幕,然後消失,沒有任何反應。 份額對話對象達到的onError與FacebookException回調:
{FacebookGraphResponseException: (#200) Requires extended permission: publish_actions httpResponseCode: 403, facebookErrorCode: 200, facebookErrorType: OAuthException, message: (#200) Requires extended permission: publish_actions}
所以我真的只需要爲Facebook網頁而不是Facebook應用程序「publish_actions」權限?奇怪..
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."
我的代碼:當Facebook應用程序是沒有 「publish_actions」 安裝不當Facebook工作
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);
}
那麼,爲什麼它的工作原理應用程序未安裝?