Facebook share dialog not working correctly in MI devices

半城伤御伤魂 提交于 2019-12-24 07:17:30

问题


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.


回答1:


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:


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.



来源:https://stackoverflow.com/questions/42452894/facebook-share-dialog-not-working-correctly-in-mi-devices

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!