0

Trying to publish photo in facebook with facebook sdk

    SharePhoto photo = new SharePhoto.Builder()
                .setBitmap(bmp)
                .build();
        SharePhotoContent content = new SharePhotoContent.Builder()
                .addPhoto(photo)
                .build();
        ShareDialog shareDialog = new ShareDialog(getActivity());
        shareDialog.show(content, ShareDialog.Mode.AUTOMATIC);
        shareDialog.registerCallback(((MainActivity) getActivity()).callbackManager, new FacebookCallback<Sharer.Result>() {
            @Override
            public void onSuccess(Sharer.Result result) {
                if (isVisible()) {
                    pbLoading.setVisibility(View.VISIBLE);

                }
            }

            @Override
            public void onCancel() {

            }

            @Override
            public void onError(FacebookException error) {
                Toast.makeText(getActivity(), "FB Error", Toast.LENGTH_LONG).show();
            }
        });

But got FacebookEcxeption

    {FacebookGraphResponseException: (#200) Requires extended permission: publish_actions httpResponseCode: 403, facebookErrorCode: 200, facebookErrorType: OAuthException, message: (#200) Requires extended permission: publish_actions}

Last version of facebook app installed on device. According to user manual no need to receive special permission if you use a ShareDialog.

Also tried to use ShareApi.share() but with the same result. What I did wrong?

w201
  • 2,018
  • 1
  • 11
  • 15
  • try this answer https://stackoverflow.com/a/29315460/4517450 – vikas kumar Jan 18 '18 at 15:39
  • Using any of the dialogs to let the user share does not require permission; but getting a _response_ does ... so my guess would be that trying to call `registerCallback` without having that permission is what actually causes the exception. – CBroe Jan 18 '18 at 15:43
  • (I can’t find this mentioned in the sharing documentation part for Android right now - but https://developers.facebook.com/docs/sharing/reference/share-dialog#response mentions it for the Web version of the share dialog, and the underlying logic is the same across platforms.) – CBroe Jan 18 '18 at 15:45
  • Seems that you are right. But how to get back result of post action without registrer call back? Or how to get this permission (only via review app in facebook)? – w201 Jan 18 '18 at 16:03

0 Answers0