Skip to content

Update SDK, allow Facebook to use Chrome Custom Tabs #249

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 11, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions app/src/main/res/values/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,9 @@
and provide your value here.
-->
<string name="facebook_application_id" translatable="false">CHANGE-ME</string>

<!--
Facebook Application ID, prefixed by 'fb'. Enables Chrome Custom tabs.
-->
<string name="facebook_login_protocol_scheme" translatable="false">fbYOUR_APP_ID</string>
</resources>
2 changes: 1 addition & 1 deletion auth/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ dependencies {
testCompile 'org.mockito:mockito-core:1.10.19'
testCompile "org.robolectric:robolectric:3.1-rc1"
compile "com.android.support:appcompat-v7:${project.ext.support_library_version}"
compile 'com.facebook.android:facebook-android-sdk:4.11.0'
compile 'com.facebook.android:facebook-android-sdk:4.14.1'
compile "com.android.support:design:${project.ext.support_library_version}"

compile "com.google.firebase:firebase-auth:${project.ext.firebase_version}"
Expand Down
25 changes: 20 additions & 5 deletions auth/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.firebase.ui.auth">

<application>
Expand Down Expand Up @@ -32,10 +33,24 @@
<activity android:theme="@style/FirebaseUI.Translucent"
android:name=".ui.ChooseAccountActivity" >
</activity>
<activity android:theme="@style/FirebaseUI.Translucent"
android:name="com.facebook.FacebookActivity"
android:configChanges=
"keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="@string/app_name" />

<activity
android:name="com.facebook.FacebookActivity"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="@string/app_name"
android:theme="@style/FirebaseUI.Translucent"
tools:replace="android:theme" />

<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/facebook_login_protocol_scheme" />
</intent-filter>
</activity>

</application>
</manifest>
10 changes: 10 additions & 0 deletions auth/src/main/res/values/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@
-->
<string name="facebook_application_id" translatable="false">CHANGE-ME</string>

<!--
To enable Chrome Custom Tabs for Facebook Login on devices without the Facebook app
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little unclear here. If they don't want to enable Chrome Custom Tabs can they do nothing and have it work? Or will it try to use fbYOUR_APP_ID as the facebook_login_protocol_scheme and break.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my testing when you have a misconfigured custom tabs setup (scheme = fbYOUR_APP_ID) it acts as if you had no custom tabs setup and falls back onto the normal webview flow.

Likely the FB SDK asks the system to handle the URL with your App ID, the system says there are no registered intent handlers, and it falls back.

installed, change this value to your Facebook App ID prefixed with 'fb'. This should be
'fb' + the value of the facebook_application_id string above

See:
https://developers.facebook.com/docs/facebook-login/android#chrome_custom_tabs
-->
<string name="facebook_login_protocol_scheme" translatable="false">fbYOUR_APP_ID</string>


<!--
The facebook permissions that this Android Application will request from the
Expand Down