4

为了我的应用程序中共享在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); 
    } 

那么,为什么它的工作原理应用程序未安装?

回答

-1

这是SharePhotoContent的要求,你必须已经安装了原生功能NEW应用,以分享照片。

Facebook Docs

照片

人们可以从您的应用程序在Facebook与分享 对话框或自定义接口分享照片。

  • 的照片必须小于12MB少在尺寸
  • 人们需要原生的Facebook的Android应用程序安装7.0或更高版本
相关问题