首页 > 解决方案 > Android facebook登录 - 卡在加载中

问题描述

我按照本教程提供 facebook 登录:https ://developers.facebook.com/docs/facebook-login/android/v2.2

我的代码中的所有内容都是相同的,并且在我拥有的所有测试设备上都运行良好。

刚刚收到设备三星 A5 - android 6.0.1 登录卡住的问题。

问题的流程是: 1. facebook 登录成功 2. 注销成功(LoginManager.getInstance().logOut(); 被调用) 3. 返回到 LoginActivity 4. 第二次尝试从 LoginActivity 进行 facebook 登录不成功,用户卡在登录屏幕上,如下面的屏幕截图所示。

在此处输入图像描述

我在这里发现了许多与 Facebook 登录卡住有关的问题。但是他们中的大多数人没有答案,或者他们的答案对我不起作用。

是什么导致了这个问题?为什么它可以在除此之外的所有设备上运行?有任何想法吗?

回调注册:

callbackManager = CallbackManager.Factory.create();
facebookLoginButton = findViewById(R.id.login_button);
facebookLoginButton.setReadPermissions(Arrays.asList(EMAIL));
facebookLoginButton.registerCallback(callbackManager, new FacebookCallback<LoginResult>() {
            @Override
            public void onSuccess(LoginResult loginResult) {
                //success
            }

            @Override
            public void onCancel() {
                //cancel
            }

            @Override
            public void onError(FacebookException exception) {
                //error
            }
        });

活动结果(但我没有到达那里):

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == 64206) {
        callbackManager.onActivityResult(requestCode, resultCode, data);
    } 
}

Logcat 没有显示任何错误。这是我点击 facebook 登录按钮后得到的日志:

D/ViewRootImpl: ViewPostImeInputStage processPointer 0
D/ViewRootImpl: ViewPostImeInputStage processPointer 1
D/ViewRootImpl: #1 mView = com.android.internal.policy.PhoneWindow$DecorView{7fbde01 V.E...... R.....I. 0,0-0,0}
I/Timeline: Timeline: Activity_launch_request id: time:15401189
V/FA: Recording user engagement, ms: 4184
V/FA: Activity paused, time: 15401224
D/ViewRootImpl: MSG_RESIZED_REPORT: ci=Rect(0, 0 - 0, 0) vi=Rect(0, 0 - 0, 0) or=1
V/FA: onActivityCreated
D/FA: Logging event (FE): user_engagement(_e), Bundle[{firebase_event_origin(_o)=auto, engagement_time_msec(_et)=4184, firebase_screen_class(_sc)=LoginActivity, firebase_screen_id(_si)=-xxx}]
D/FA: Logging event (FE): screen_view(_vs), Bundle[{firebase_event_origin(_o)=auto, firebase_previous_class(_pc)=LoginActivity, firebase_previous_id(_pi)=-xxx, firebase_screen_class(_sc)=FacebookActivity, firebase_screen_id(_si)=-xxx}]
D/SecWifiDisplayUtil: Metadata value : none
D/ViewRootImpl: #1 mView = com.android.internal.policy.PhoneWindow$DecorView{a06ce06 V.E...... R.....I. 0,0-0,0}
D/ViewRootImpl: #1 mView = com.android.internal.policy.PhoneWindow$DecorView{64fbcc7 I.E...... R.....I. 0,0-0,0}
V/FA: Activity resumed, time: 15401264
D/ViewRootImpl: #1 mView = com.android.internal.policy.PhoneWindow$DecorView{5b65b7 V.E...... R.....I. 0,0-0,0}
D/ViewRootImpl: MSG_RESIZED_REPORT: ci=Rect(0, 48 - 0, 0) vi=Rect(0, 48 - 0, 0) or=1
MSG_RESIZED_REPORT: ci=Rect(0, 48 - 0, 0) vi=Rect(0, 48 - 0, 0) or=1
D/ViewRootImpl: MSG_RESIZED_REPORT: ci=Rect(0, 0 - 0, 0) vi=Rect(0, 0 - 0, 0) or=1
V/FA: Inactivity, disconnecting from the service

标签: androidfacebook

解决方案


推荐阅读