Open the facebook login screen in your personal app, not your device browser.

When the Facebook app is installed on the device and I am not logged in. My own app opens the facebook app when you click the facebook login button. If I am login to facebook app, my own app accepts login details from facebook app and allows me to use login information. When I don't have facebook app installed on the device, the first time I click the facebook login button in its own app, it opens the facebook login page in the default device browser and saves my login credentials next time. next time i try to login directly, please enter login details.

The problem is when I open the default facebook site in the device browser (like chrome). I get directly logged into the account that I have logged into my application.

the browser is caching the login data, I want to stop this.

So, I want to open a login dialog containing a facebook login webview when you click the facebook button.

I took a 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 this?

+3


source to share


2 answers


You have to do it in your code, it will work for you.

LoginManager.getInstance () setLoginBehavior (LoginBehavior.WEB_VIEW_ONLY). OR facebookLoginButton.setLoginBehavior (LoginBehavior.WEB_VIEW_ONLY);



For more information see below link

https://developers.facebook.com/docs/reference/android/current/class/LoginBehavior/

+4


source


For FaceBook add this tag to your Manifest.XML file

<activity
            android:name="com.facebook.CustomTabActivity"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />

                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />

                <data android:scheme="@string/fb_login_protocol_scheme" />
            </intent-filter>
        </activity>

      



and get value fb_login_protocol_scheme

from app bar in facebook apps

0


source







All Articles