从我的应用程序登录到Facebook的工作在模拟器但不是在装置 [英] logging in to facebook from my app works on emulator but not on device

查看:138
本文介绍了从我的应用程序登录到Facebook的工作在模拟器但不是在装置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的code,以登录到Facebook。

This is my code for logging in to facebook.

mLoginButton = (LoginButton) findViewById(R.id.login);

        // restore session if one exists
        SessionStore.restore(Utility.mFacebook, this);
        SessionEvents.addAuthListener(new FbAPIsAuthListener());
        SessionEvents.addLogoutListener(new FbAPIsLogoutListener());

        /*
         * Source Tag: login_tag
         */
        mLoginButton.init(this, AUTHORIZE_ACTIVITY_RESULT_CODE, Utility.mFacebook, permissions);

        if (Utility.mFacebook.isSessionValid()) {
            requestUserData();
        }
 public class FbAPIsAuthListener implements AuthListener {

        //@Override
        public void onAuthSucceed() {
            requestUserData();
        }

        //@Override
        public void onAuthFail(String error) {
            mText.setText("Login Failed: " + error);
        }
    }

    /*
     * The Callback for notifying the application when log out starts and
     * finishes.
     */
    public class FbAPIsLogoutListener implements LogoutListener {
        //@Override
        public void onLogoutBegin() {
            mText.setText("Logging out...");
        }

        ///@Override
        public void onLogoutFinish() {
            mText.setText("You have logged out! ");
            mUserPic.setImageBitmap(null);
        }
    }

在模拟器它运行完美。我在尝试吨3台设备,那些已经安装了Facebook的,这里是这个问题。

On emulator it works perfect. I have tried in ton 3 devices, that have already facebook installed and here is the problem.

它只是纺纱不要蜘蛛装上,它什么都不做。我再次看到登录按钮。
然后我试图从原来的Facebook应用程序注销,而当pressing我的应用程序的登录按钮,我看到登录窗口,但现在,我见惯了在模拟器登录时,但原来的Facebook应用程序的登录窗口。就像是已经开始这一个。

it just spinning aroun on loading and it does nothing. I see the login button again. Then i tried to logout from the original facebook application, and when pressing the login button on my app, i see the login window but now that I used to see when logging in the emulator but the login window of the original facebook application. Like is has started this one.

我使用的是code从hackbook.java采取

the code I am using is taken from the hackbook.java

推荐答案

该平台状态说,有与SSO有问题。

The Platform Status says that there's a problem with the SSO.

如果您已经安装在Android设备上的Facebook应用程序,和你的描述完美地融入这一切的SSO只适用。
在模拟器上你没有Facebook应用程序,所以当你的应用程序试图登录的用户,它使用它的对话框中SDK,而不是使用SSO过程中附带的应用程序FB

The SSO only works if you have the facebook application installed on the android device, and what you describe fits right into all of this. On the emulator you don't have the facebook application, and so when your application tries to log the user in it uses the dialog it has in the sdk instead of using the SSO process that ships with the fb application.

在怎么过,你说你有FB的应用程序,所以SSO踢,至少目前,有一个问题,它的设备。
尝试卸载设备上的Facebook应用程序或者只是取消SSO,即:<一href=\"http://stackoverflow.com/questions/4521013/how-to-disable-facebook-single-sign-on-for-android-facebook-android-sdk\">How在Android的Facebook的禁用单点登录 - Facebook的Andr​​oid的SDK

On the device how ever you said that you do have the fb app, and so the SSO kicks in and, at least currently, there's a problem with it. Try to uninstall the facebook application on the device or maybe just cancel the SSO, i.e.: How to disable Facebook single sign on for android - Facebook-android-sdk

这篇关于从我的应用程序登录到Facebook的工作在模拟器但不是在装置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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