androidfacebook-sharereact-native-fbsdkfbsdksharedialog

FBSDK Share not working in react-native app. On some android devices only


I am using react-native-fbsdk in my react-native application. I followed the official setup guide for the same. And managed to integrate it in the app.

I am using following standard code to share the link using ShareDialog

const shareLinkContent = {
                             contentType: 'link',
                             contentUrl: 'http://www.google.com',
                             quote: 'try this',
                         };

ShareDialog.canShow(shareLinkContent)
                .then(
                    (canShow) => {
                        if (canShow) {
                            return ShareDialog.show(shareLinkContent);
                        }
                    },
                )
                .then(
                    (result) => {
                        if (result.isCancelled) {
                            alert('Share cancelled');
                        } else {
                            alert(`Share success with postId: ${
                                result.postId }`);
                        }
                    },
                    (error) => {
                        alert(`Share fail with error: ${ error }`); // I get the error on this line.
                    },
                );

Above code works fine on iOS and some of the android devices. But on some android devices i get error as Share fail with error: Error: API_ERROR: API_ERROR

Not getting what is wrong for only subset of devices

Devices i faced problems are

Google Pixel gen 1, Some SAMSUNG devices, oppo.

Devices i managed to run without errors :

Xiaomi redme note 4, google nexus 5

Thanks in advance for the help


Solution

  • Posting it late: I figured out what was the problem.

    The facebook app need to be published to production on the facebook developer console. Hope it helps you all reading this.