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
qwerty_gr
source share