Search code examples
androidfacebook-android-sdk

facebook sdk Insufficient permissions for sharing content via Api


In my app there is a basic photo editor, i'd like the users to share these photos to share to Facebook, AFAIK, Facebook Sharing doesn't require publish_actions approval. i use the share api like this:

Bitmap bitmap = imageContainer.getDrawingCache();
        SharePhoto photo = new SharePhoto.Builder()
                .setBitmap(bitmap)
                .setCaption("Check my new photo")
                .build();
        SharePhotoContent content = new SharePhotoContent.Builder()
                .addPhoto(photo)
                .build();
        ShareApi.share(content, new FacebookCallback<Sharer.Result>() {
            @Override
            public void onSuccess(Sharer.Result result) {
                Log.i("success", result.toString());
            }

            @Override
            public void onCancel() {


            }

            @Override
            public void onError(FacebookException error) {
                Log.i("error", error.getMessage());

            }

i have configured the facebook content provider and everything else as mentioned in the Facebook developer website. but i keep getting this error message Insufficient permissions for sharing content via Api. does anyone know what the issue is and how to solve it?


Solution

  • You are using the code for a custom interface right now (ShareApi.share):

    If you want to use your own interface for sharing, you need to: ... Request the publish_actions permission when people log into your app

    Source: https://developers.facebook.com/docs/sharing/android

    Take a look at the docs, this may be what you need instead:

    ShareDialog.show(activityOrFragment, content);