1
votes

ShareLinkContent code

ShareLinkContent content = new ShareLinkContent.Builder()
                        .setContentUrl(Uri.parse(shareUrl))
                        .setContentTitle(shareTitle)
                        .build();

Share Dialog codes that I tried

a. Using Share Dialog object

ShareDialog dialog = new ShareDialog(this);
dialog.show(content, ShareDialog.Mode.AUTOMATIC); //tried other 4 modes too

b. Using static access

ShareDialog.show(this, content);

Now the issue is, it works perfectly well in all the regular phones like Motorola, Samsung, Pixel, Lenovo.

But same code is causing weird behaviour in Redmi devices. When I click the button that invokes this code, keyboard and Share dialog appears, stays there for few milliseconds and then disappear.

Am i supposed to anything special to handle Facebook dialogs in MI devices?

There is an option of creating custom dialog box, but I want to keep it as the last option.

Edit

Same is happening with Facebook Like button too.

Here is the code for Facebook like button

facebookLikeView.setObjectIdAndType("https://www.facebook.com/StartupScribble/", LikeView.ObjectType.PAGE);

This code too works perfectly in most of the devices except Redmi devices.

2
Check your facebook link data. Mostly that causes the Facebook Share dialog to disappear.Rahul Shukla

2 Answers

6
votes

I had the same problem while developing an app. My problem was that the Facebook-app was still in developer-mode. The Facebook-account that was logged in on the device was not added to the Facebook-app as an Administrator, Developer, or Tester.

The account didn't have permission to access the app, and the share-dialog was closed almost immediately after appearing. This was solved when I logged in with the right Facebook-account.

When testing your apps, place them into development mode. This hides your app entirely from all users who you have not authorized in the App Dashboard to see the app, for the roles described below. Please note that when your app is in development mode, you can't call any API calls on behalf of users who cannot see your app.

The above text comes from the facebook-documentation where they explain more about the roles.

2
votes

Another reason is because of a bug in native android facebook application in the version of 179.0.0.44.83, in this version, the ShareDialog will not work because of internal bug in Native Facebook Application.