Facebook login with Chrome Custom Tabs

Posted: September 1, 2016

Chrome Custom Tabs is an Android library providing in-app view with Chrome-like look and feel. Furthermore, it shares cookies stored by the browser and as a result, users don’t have to type in their account details again if they have signed in to Facebook before using Chrome. The library offers better user experience compared to in-app web view, which requires user’s details every time. Of course, if native Facebook app is installed, it’ll be used instead.

Chrome Custom Tabs are supported on Android 4.1 with Chrome browser installed and AIRFacebook extension from version 1.4.3. It is an optional feature, and the native SDK will fallback to in-app web view if the library is not included in your app.

To support Custom Tabs in your app, update AIRFacebook to version 1.4.3 or newer. Then download custom tabs extension from this repository and include it in your project by adding its ID to your app descriptor XML:


Finally, add the custom tab activities to your Android manifest:

        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <data android:scheme="fb{FACEBOOK_APP_ID}" />

Note you need to replace {FACEBOOK_APP_ID} with the app ID as specified in the dashboard of your Facebook app.

Visit the Modifying AIR descriptor file section of the setup guide if you’re unsure where to paste this snippet.