Logging into facebook from my application works on the emulator, but not on the device

This is my facebook login code.

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); } } 

It works great on the emulator. I tried in 3 tons of devices that are already installed on facebook, and here is the problem.

it just spins around at boot, and it does nothing. I see the login button again. Then I tried to exit the original facebook application, and when I click the login button in my application, I see the login window, but now that I saw it, when I registered in the emulator, but in the login window for the original facebook application. As it began.

The code I use is taken from hackbook.java

+7
source share
2 answers

The status of the platform indicates a problem with SSO.

SSO only works if you have the facebook application installed on your Android device, and what you describe is suitable for all of this. You do not have a facebook application on the emulator, so when your application tries to log in, the user uses it in sdk instead of using the SSO process that comes with the fb application.

On the device, as you said, you have a fb application, and therefore SSO is starting and, at least for the time being, there is a problem with it. Try uninstalling the facebook application on the device or maybe just canceling the SSO, i.e. How to disable one-time Facebook for Android - Facebook-android-sdk

+3
source

You need to generate the hash key of your system and just place it by editing the existing facebook application.

0
source

All Articles