Facebook共享对话框在MI设备中无法正常工作 [英] Facebook share dialog not working correctly in MI devices

查看:113
本文介绍了Facebook共享对话框在MI设备中无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

ShareLinkContent代码

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

共享我尝试过的对话框代码

a.使用共享对话框对象

a. Using Share Dialog object

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

b.使用静态访问

ShareDialog.show(this, content);

现在的问题是,它在摩托罗拉,三星,Pixel和联想等所有普通手机中都能很好地工作.

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

但是相同的代码在Redmi设备中导致奇怪的行为.当我单击调用此代码的按钮时,将出现键盘和共享"对话框,并在其中停留几毫秒,然后消失.

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.

在处理MI设备中的Facebook对话框时,我应该做些特别的事情吗?

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.

修改

Facebook的赞"按钮也发生了同样的事情.

Same is happening with Facebook Like button too.

这是Facebook的类似按钮的代码

Here is the code for Facebook like button

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

除了Redmi设备外,此代码在大多数设备上也能完美运行.

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

推荐答案

在开发应用程序时,我遇到了同样的问题.我的问题是Facebook应用仍处于开发人员模式.没有以管理员,开发人员或测试人员的身份将设备上登录的Facebook帐户添加到Facebook应用程序中.

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.

该帐户无权访问该应用,并且共享对话框显示后几乎立即被关闭. 当我使用正确的Facebook帐户登录时,此问题已解决.

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.

在测试您的应用程序时,请将其置于开发模式.对于下面描述的角色,这会将您的应用完全隐藏给您所有未经您授权在应用程序仪表板"中查看该应用程序的用户.请注意,当您的应用处于开发模式时,您不能代表看不见您的应用的用户调用任何API调用.

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.

以上文字来自 facebook文档,其中他们详细介绍了角色

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

这篇关于Facebook共享对话框在MI设备中无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆