Android facebook登录无法使用已安装的Facebook应用程序 [英] Android facebook login not working with installed Facebook app

查看:2115
本文介绍了Android facebook登录无法使用已安装的Facebook应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经设置了简单的Facebook登录。对于Android 2.3.6,所有功能都应该如此,用户获得提示登录对话框,输入数据和应用程序继续。我以为这是Android版本的错误,但是当手机上安装了Facebook应用程序时,却发现登录不起作用!



测试了:
Galaxy Ace 2.3.6
HTC Desire 4.1.2
Galaxy Note 4.1.2
Android模拟器4.1.2



甚至Facebook的样品不工作!



每次应用程序执行时 - else {
Log.d(SESSION NOT OPENED ,SESSION NOT OPENED);
}



似乎会话没有打开,但为什么呢?遵循本指南 - https://developers.facebook.com/docs/getting -started / facebook-sdk-for-android / 3.0 /



代码:

  Session.openActiveSession(this,true,new Session.StatusCallback(){

@Override
public void call(final Session session,SessionState state,Exception exception ){

if(session.isOpened()){

Request.executeMeRequestAsync(session,new Request.GraphUserCallback(){

@Override
public void onCompleted(GraphUser user,Response response){
if(user!= null){
Log.d(Access_token,session.getAccessToken());
}
}
});
} else {
Log.d(SESSION N OT已开放,SESSION NOT OPENED);
}
}
});


解决方案

查看步骤4的底部: https://developers.facebook.com/docs/getting-started /facebook-sdk-for-android/3.0/



如果您没有正确输入应用程序密钥哈希,Facebook通过WebView弹出窗口登录(如果应用程序未安装)仍然可以工作,但通过本机Facebook应用程序登录将不会。



您应该在LogCat中看到此异常:

  com.facebook.http.protocol.ApiException:remote_app_id与存储的ID不匹配

Facebook SDK打印出异常,如果还有其他问题,请检查。


I have set up simple facebook login. For Android 2.3.6 everything works as should, user gets prompt login dialog, enters data and app goes on. I thought that it was android versions fault but it turs out that the login isn't working when there is facebook application installed on the phone!

Tested this on: Galaxy Ace 2.3.6 HTC Desire 4.1.2 Galaxy Note 4.1.2 Android emulator 4.1.2

Even the facebook samples are not working!

Every time the app is executing - else { Log.d("SESSION NOT OPENED", "SESSION NOT OPENED"); }

It seems like session isn't opened but why is that? Followed this guide - https://developers.facebook.com/docs/getting-started/facebook-sdk-for-android/3.0/

Code:

Session.openActiveSession(this, true, new Session.StatusCallback() {

        @Override
        public void call(final Session session, SessionState state, Exception exception) {

            if (session.isOpened()) {

                Request.executeMeRequestAsync(session, new Request.GraphUserCallback() {

                    @Override
                    public void onCompleted(GraphUser user, Response response) {
                        if (user != null) {
                            Log.d("Access_token", session.getAccessToken());
                        }
                    }
                });
            } else {
                Log.d("SESSION NOT OPENED", "SESSION NOT OPENED");
            }
        }
    });

解决方案

Check out the bottom of step 4: https://developers.facebook.com/docs/getting-started/facebook-sdk-for-android/3.0/

If you have not entered your app key hash properly, Facebook login via the WebView popup (if the app is not installed) will still work, but login via the native Facebook app won't.

You should see this exception in LogCat:

com.facebook.http.protocol.ApiException: remote_app_id does not match stored id

The Facebook SDK prints its exceptions so check there anyway if there are other problems.

这篇关于Android facebook登录无法使用已安装的Facebook应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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