'Facebook login not working with facebook application

I am coding for the Login with the Facebook into my android application.I am following this STEPS.

I have problem that The logout button is not showing after login, it still displayed me login button. This problem is occure when I install the facebook app into emulator, but without install facebookapp it's working.

Login button

After install Facebook Application :

enter image description here

  1. Press on the login button(From my application)
  2. If not login then redirect to the facebook app
  3. After login into facebook app back to my app and don't show me logout button but instead of logout it show me login button

Without install Facebook app : [This is working as I want]

enter image description here

  1. press the login button(from my application)
  2. Redirect to the facebook page (I don't know about this page)
  3. After login success back to my app, and show logout button.

enter image description here

Now In short, I want second senario same for the First Senario.

Thanks.



Solution 1:[1]

You may want to use FORCE_DIALOG_AUTH while facebook.authorize

facebook.authorize(HomeTab.this, new String[] {"publish_stream"}, Facebook.FORCE_DIALOG_AUTH,new Facebook.DialogListener() {

As you can see third parameter use FORCE_DIALOG_AUTH.

Solution 2:[2]

old but, in section with LoginButton authButton = (LoginButton) view.findViewById(R.id.authButton); add

authButton.setLoginBehavior(SessionLoginBehavior.SUPPRESS_SSO);

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Amit Hooda
Solution 2 Eugene Pinchuk