When Facebook app are installed on device and i am not log in. My own app opens facebook app when click on facebook login button.and if i am login on facebook app, my own app takes login details from facebook app and let me use login info. When i don't have facebook app installed on device, first time when i click on facebook login button in my own app it open facebook login page on default device browser and save my login credentials for next time. when next time i try to login it directly fetch login info.
issue is when i open facebook website on default device browser (say chrome)explicitly. i directly get login to the account which i have loges in from my own app.
browser is caching login data, i want to stop that.
So i want to open login dialog contain webview for facebook login when click on facebook button.
I have taken button in xml like below
<com.facebook.login.widget.LoginButton
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:facebook="http://schemas.android.com/apk/res-auto"
android:id="@+id/button_facebook_login"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
How can i achieve that?
You have to add below code in your activity it will work for you.
LoginManager.getInstance().setLoginBehavior(LoginBehavior.WEB_VIEW_ONLY);
OR
facebookLoginButton.setLoginBehavior(LoginBehavior.WEB_VIEW_ONLY);
For more info please see below link
https://developers.facebook.com/docs/reference/android/current/class/LoginBehavior/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With