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












1















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










share|improve this question



























    1















    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










    share|improve this question

























      1












      1








      1








      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










      share|improve this question














      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







      android facebook-share react-native-fbsdk fbsdksharedialog






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 28 '18 at 7:24









      Harshal BhavsarHarshal Bhavsar

      851930




      851930
























          2 Answers
          2






          active

          oldest

          votes


















          0














          I am also facing the same problem for my app. I am creating a react native based app that is using fbsdk. I followed the steps from React Native FBSDK. I get no error from android when I run it. The compilation is fine and the app is also running perfectly on mobile.



          When I run react-native run-android I have no error and I can even see facebook loginButton. But when I click on the button, it doesn't bring me to the facebook login page most of the times. Specially in Samsung mobile series its not opening login page or sometimes i need to click multiple to the loginButton then it appears login page. In other mobiles its working fine.



          I found this issue specifically in Android 8 and 9 versions of Samsung Galaxy (S6, S7, S8, S9, S9+) and Samsung Note 9 series. The issue is occurring random, means sometimes the login button is showing popup to login with facebook and sometimes not. Similarly sometimes share dialog is opening and sometimes not.



          Even I tried in emulator of Samsung Galaxy (S6, S7, S8, S9, S9+) and Samsung Note 9 series, but its working fine in emulators. I cannot be able to debug the actual cause of such error. It is happening only in real device.



          I have posted the same issued in React Native github repository as:



          This and this



          And from last 2 weeks waiting for response from fbsdk team but till now no one responded. Today I have posted the same issue on fb developers as a Bug check it here






          share|improve this answer



















          • 1





            zeeshan you can contact me on twitter

            – Harshal Bhavsar
            Feb 2 at 14:21



















          0














          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.






          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53514164%2ffbsdk-share-not-working-in-react-native-app-on-some-android-devices-only%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            I am also facing the same problem for my app. I am creating a react native based app that is using fbsdk. I followed the steps from React Native FBSDK. I get no error from android when I run it. The compilation is fine and the app is also running perfectly on mobile.



            When I run react-native run-android I have no error and I can even see facebook loginButton. But when I click on the button, it doesn't bring me to the facebook login page most of the times. Specially in Samsung mobile series its not opening login page or sometimes i need to click multiple to the loginButton then it appears login page. In other mobiles its working fine.



            I found this issue specifically in Android 8 and 9 versions of Samsung Galaxy (S6, S7, S8, S9, S9+) and Samsung Note 9 series. The issue is occurring random, means sometimes the login button is showing popup to login with facebook and sometimes not. Similarly sometimes share dialog is opening and sometimes not.



            Even I tried in emulator of Samsung Galaxy (S6, S7, S8, S9, S9+) and Samsung Note 9 series, but its working fine in emulators. I cannot be able to debug the actual cause of such error. It is happening only in real device.



            I have posted the same issued in React Native github repository as:



            This and this



            And from last 2 weeks waiting for response from fbsdk team but till now no one responded. Today I have posted the same issue on fb developers as a Bug check it here






            share|improve this answer



















            • 1





              zeeshan you can contact me on twitter

              – Harshal Bhavsar
              Feb 2 at 14:21
















            0














            I am also facing the same problem for my app. I am creating a react native based app that is using fbsdk. I followed the steps from React Native FBSDK. I get no error from android when I run it. The compilation is fine and the app is also running perfectly on mobile.



            When I run react-native run-android I have no error and I can even see facebook loginButton. But when I click on the button, it doesn't bring me to the facebook login page most of the times. Specially in Samsung mobile series its not opening login page or sometimes i need to click multiple to the loginButton then it appears login page. In other mobiles its working fine.



            I found this issue specifically in Android 8 and 9 versions of Samsung Galaxy (S6, S7, S8, S9, S9+) and Samsung Note 9 series. The issue is occurring random, means sometimes the login button is showing popup to login with facebook and sometimes not. Similarly sometimes share dialog is opening and sometimes not.



            Even I tried in emulator of Samsung Galaxy (S6, S7, S8, S9, S9+) and Samsung Note 9 series, but its working fine in emulators. I cannot be able to debug the actual cause of such error. It is happening only in real device.



            I have posted the same issued in React Native github repository as:



            This and this



            And from last 2 weeks waiting for response from fbsdk team but till now no one responded. Today I have posted the same issue on fb developers as a Bug check it here






            share|improve this answer



















            • 1





              zeeshan you can contact me on twitter

              – Harshal Bhavsar
              Feb 2 at 14:21














            0












            0








            0







            I am also facing the same problem for my app. I am creating a react native based app that is using fbsdk. I followed the steps from React Native FBSDK. I get no error from android when I run it. The compilation is fine and the app is also running perfectly on mobile.



            When I run react-native run-android I have no error and I can even see facebook loginButton. But when I click on the button, it doesn't bring me to the facebook login page most of the times. Specially in Samsung mobile series its not opening login page or sometimes i need to click multiple to the loginButton then it appears login page. In other mobiles its working fine.



            I found this issue specifically in Android 8 and 9 versions of Samsung Galaxy (S6, S7, S8, S9, S9+) and Samsung Note 9 series. The issue is occurring random, means sometimes the login button is showing popup to login with facebook and sometimes not. Similarly sometimes share dialog is opening and sometimes not.



            Even I tried in emulator of Samsung Galaxy (S6, S7, S8, S9, S9+) and Samsung Note 9 series, but its working fine in emulators. I cannot be able to debug the actual cause of such error. It is happening only in real device.



            I have posted the same issued in React Native github repository as:



            This and this



            And from last 2 weeks waiting for response from fbsdk team but till now no one responded. Today I have posted the same issue on fb developers as a Bug check it here






            share|improve this answer













            I am also facing the same problem for my app. I am creating a react native based app that is using fbsdk. I followed the steps from React Native FBSDK. I get no error from android when I run it. The compilation is fine and the app is also running perfectly on mobile.



            When I run react-native run-android I have no error and I can even see facebook loginButton. But when I click on the button, it doesn't bring me to the facebook login page most of the times. Specially in Samsung mobile series its not opening login page or sometimes i need to click multiple to the loginButton then it appears login page. In other mobiles its working fine.



            I found this issue specifically in Android 8 and 9 versions of Samsung Galaxy (S6, S7, S8, S9, S9+) and Samsung Note 9 series. The issue is occurring random, means sometimes the login button is showing popup to login with facebook and sometimes not. Similarly sometimes share dialog is opening and sometimes not.



            Even I tried in emulator of Samsung Galaxy (S6, S7, S8, S9, S9+) and Samsung Note 9 series, but its working fine in emulators. I cannot be able to debug the actual cause of such error. It is happening only in real device.



            I have posted the same issued in React Native github repository as:



            This and this



            And from last 2 weeks waiting for response from fbsdk team but till now no one responded. Today I have posted the same issue on fb developers as a Bug check it here







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Feb 2 at 6:42









            Syed Muhammad ZeeshanSyed Muhammad Zeeshan

            760514




            760514








            • 1





              zeeshan you can contact me on twitter

              – Harshal Bhavsar
              Feb 2 at 14:21














            • 1





              zeeshan you can contact me on twitter

              – Harshal Bhavsar
              Feb 2 at 14:21








            1




            1





            zeeshan you can contact me on twitter

            – Harshal Bhavsar
            Feb 2 at 14:21





            zeeshan you can contact me on twitter

            – Harshal Bhavsar
            Feb 2 at 14:21













            0














            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.






            share|improve this answer




























              0














              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.






              share|improve this answer


























                0












                0








                0







                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.






                share|improve this answer













                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.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Feb 2 at 7:28









                Harshal BhavsarHarshal Bhavsar

                851930




                851930






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53514164%2ffbsdk-share-not-working-in-react-native-app-on-some-android-devices-only%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

                    Calculate evaluation metrics using cross_val_predict sklearn

                    Insert data from modal to MySQL (multiple modal on website)