Android的 - Facebook的SDK登录窗口消失窗口、Android、Facebook、SDK

2023-09-08 00:29:28 作者:橘子味的猫。

我想使用Android SDK Facebook的 - 但没有运气。问题是,Facebook的登录窗口开始加载,但任何事情发生之前消失。这是一个实际的设备上的行为,在模拟器上都还是不错的。

I am trying to use the Android Facebook SDK - but with no luck. The problem is that the Facebook Login window starts loading, but before anything happens it disappears. This is the behaviour on an actual device, on the emulator all is good.

我做了什么:

从这里 下载SDK添加的java文件到我的项目。创建一个Facebook应用程序。拿到了钥匙哈希值和更新我的Facebook应用程序。

但我不能得到的登录窗口出现。我没有看到在logcat中的任何错误,仅此:

But I cant get the Login window to appear. I dont see any error on the logcat, only this:

ActivityManager(2698年):启动:{意向CMP = com.facebook.katana / .ProxyAuth(有临时演员)  ActivityManager(2698):尝试推出com.facebook.katana / .ProxyAuth  ActivityManager(2698):显示com.facebook.katana / .ProxyAuth:+ 371ms(总+ 466ms)

ActivityManager( 2698): Starting: Intent { cmp=com.facebook.katana/.ProxyAuth (has extras) ActivityManager( 2698): Trying to launch com.facebook.katana/.ProxyAuth ActivityManager( 2698): Displayed com.facebook.katana/.ProxyAuth: +371ms (total +466ms)

任何想法?

10X:)

编辑:似乎增加code到活动的这些线路解决了这个问题:

It seems adding these lines of code to the activity solved the problem:

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    facebook.authorizeCallback(requestCode, resultCode, data);
}

如果得到了从这里:SO问

推荐答案

这com.facebook.katana这logcat的错误是从Android的Facebook应用程序。是安装在手机上?它听起来就像是和你默认为单点登录(SSO)?试着做你的授权为

That logcat error from com.facebook.katana is from the Android Facebook app. Is that installed on the phone? It sounds like it is and you are defaulting to Single Sign On (SSO)? Try doing your authorize as

authorize(this, PERMISSIONS, FORCE_DIALOG_AUTH, new LoginDialogListener());

避免了单点登录和强制对话框登录。如果您规避崩溃,那么最可能的原因是SDK和安装Facebook应用程序之间的不匹配。他们往往是相当挑剔一起工作。如果是这样,你可能必须尝试多个不同的版本每找到一个稳定的对之前。

which avoids SSO and forces a dialog login. If that circumvents your crash, then the most likely cause is a mismatch between the SDK and the installed Facebook app. They do tend to be quite picky about working together. If so, you'll probably have to try several different versions of each before you find a stable pair.