@@ -62,7 +62,7 @@ Gradle, add the dependency:
62
62
``` groovy
63
63
dependencies {
64
64
// ...
65
- implementation 'com.firebaseui:firebase-ui-auth:3.1.3 '
65
+ implementation 'com.firebaseui:firebase-ui-auth:3.2.0 '
66
66
67
67
// Required only if Facebook login support is required
68
68
// Find the latest Facebook SDK releases here: https://goo.gl/Ce5L94
@@ -216,16 +216,16 @@ You can enable sign-in providers like Google Sign-In or Facebook Log In by calli
216
216
217
217
``` java
218
218
startActivityForResult(
219
- AuthUI . getInstance()
220
- .createSignInIntentBuilder()
221
- .setAvailableProviders(
222
- Arrays . asList( new AuthUI .IdpConfig .Builder ( AuthUI . EMAIL_PROVIDER ). build(),
223
- new AuthUI .IdpConfig .Builder ( AuthUI . PHONE_VERIFICATION_PROVIDER ). build(),
224
- new AuthUI .IdpConfig .Builder ( AuthUI . GOOGLE_PROVIDER ). build(),
225
- new AuthUI .IdpConfig .Builder ( AuthUI . FACEBOOK_PROVIDER ). build(),
226
- new AuthUI .IdpConfig .Builder ( AuthUI . TWITTER_PROVIDER ). build()))
227
- .build(),
228
- RC_SIGN_IN );
219
+ AuthUI . getInstance()
220
+ .createSignInIntentBuilder()
221
+ .setAvailableProviders( Arrays . asList (
222
+ new AuthUI .IdpConfig .EmailBuilder ( ). build(),
223
+ new AuthUI .IdpConfig .PhoneBuilder ( ). build(),
224
+ new AuthUI .IdpConfig .GoogleBuilder ( ). build(),
225
+ new AuthUI .IdpConfig .FacebookBuilder ( ). build(),
226
+ new AuthUI .IdpConfig .TwitterBuilder ( ). build()))
227
+ .build(),
228
+ RC_SIGN_IN );
229
229
```
230
230
231
231
##### Adding a ToS and privacy policy
@@ -260,28 +260,30 @@ startActivityForResult(
260
260
RC_SIGN_IN );
261
261
```
262
262
263
- It is often desirable to disable Smart Lock in development but enable it in production. To achieve
264
- this, you can use the ` BuildConfig.DEBUG ` flag to control Smart Lock:
263
+ ###### Smart Lock hints
264
+
265
+ If you'd like to keep Smart Lock's "hints" but disable the saving/retrieving of credentials, then
266
+ you can use the two-argument version of ` setIsSmartLockEnabled ` :
265
267
266
268
``` java
267
269
startActivityForResult(
268
270
AuthUI . getInstance()
269
271
.createSignInIntentBuilder()
270
- .setIsSmartLockEnabled(! BuildConfig . DEBUG )
272
+ .setIsSmartLockEnabled(false , true )
271
273
.build(),
272
274
RC_SIGN_IN );
273
275
```
274
276
275
- ###### Smart Lock hints
277
+ ###### Smart Lock in dev builds
276
278
277
- If you'd like to keep Smart Lock's "hints" but disable the saving/retrieving of credentials, then
278
- you can use the two-argument version of ` setIsSmartLockEnabled ` :
279
+ It is often desirable to disable Smart Lock in development but enable it in production. To achieve
280
+ this, you can use the ` BuildConfig.DEBUG ` flag to control Smart Lock :
279
281
280
282
``` java
281
283
startActivityForResult(
282
284
AuthUI . getInstance()
283
285
.createSignInIntentBuilder()
284
- .setIsSmartLockEnabled(false , true )
286
+ .setIsSmartLockEnabled(! BuildConfig . DEBUG /* credentials */ , true /* hints */ )
285
287
.build(),
286
288
RC_SIGN_IN );
287
289
```
@@ -293,27 +295,27 @@ provide a default phone number (in international format) that will be used to pr
293
295
country code and phone number input fields. The user is still able to edit the number if desired.
294
296
295
297
``` java
296
- // Use a Bundle to hold the default number, and pass it to the Builder via setParams:
297
- Bundle params = new Bundle ();
298
- params. putString(AuthUI . EXTRA_DEFAULT_PHONE_NUMBER , " +123456789" );
299
- IdpConfig phoneConfigWithDefaultNumber =
300
- new IdpConfig .Builder (AuthUI . PHONE_VERIFICATION_PROVIDER )
301
- .setParams(params)
302
- .build();
298
+ IdpConfig phoneConfigWithDefaultNumber = new IdpConfig .PhoneBuilder ()
299
+ .setDefaultNumber(" +123456789" )
300
+ .build();
301
+ ```
302
+
303
+ Alternatively, you can set only the default phone number country.
304
+
305
+ ``` java
306
+ IdpConfig phoneConfigWithDefaultNumber = new IdpConfig .PhoneBuilder ()
307
+ .setDefaultCountryIso(" ca" )
308
+ .build();
303
309
```
304
310
305
311
It is also possible to set a default country code along with a national number if a specific country
306
312
is your app's target audience. This will take precedence over the full default phone number if both
307
313
are provided.
308
314
309
315
``` java
310
- Bundle params = new Bundle ();
311
- params. putString(AuthUI . EXTRA_DEFAULT_COUNTRY_CODE , " ca" );
312
- params. putString(AuthUI . EXTRA_DEFAULT_NATIONAL_NUMBER , " 23456789" );
313
- IdpConfig phoneConfigWithDefaultCountryAndNationalNumber =
314
- new IdpConfig .Builder (AuthUI . PHONE_VERIFICATION_PROVIDER )
315
- .setParams(params)
316
- .build();
316
+ IdpConfig phoneConfigWithDefaultNumber = new IdpConfig .PhoneBuilder ()
317
+ .setDefaultNumber(" ca" , " 23456789" )
318
+ .build();
317
319
```
318
320
319
321
### Handling the sign-in response
@@ -561,50 +563,46 @@ at a diff of the `strings.xml` file before updating FirebaseUI.
561
563
562
564
### Google
563
565
By default, FirebaseUI requests the ` email ` and ` profile ` scopes when using Google Sign-In. If you
564
- would like to request additional scopes from the user, call ` setPermissions ` on the
565
- ` AuthUI.IdpConfig.Builder ` when initializing FirebaseUI.
566
+ would like to request additional scopes from the user, call ` setScopes ` on the
567
+ ` AuthUI.IdpConfig.GoogleBuilder ` when initializing FirebaseUI.
566
568
567
569
568
570
``` java
569
571
// For a list of all scopes, see:
570
572
// https://developers.google.com/identity/protocols/googlescopes
571
- AuthUI . IdpConfig googleIdp = new AuthUI .IdpConfig .Builder ( AuthUI . GOOGLE_PROVIDER )
572
- .setPermissions (Arrays . asList(Scopes . GAMES ))
573
- .build();
573
+ AuthUI . IdpConfig googleIdp = new AuthUI .IdpConfig .GoogleBuilder ( )
574
+ .setScopes (Arrays . asList(Scopes . GAMES ))
575
+ .build();
574
576
575
577
startActivityForResult(
576
- AuthUI . getInstance()
577
- .createSignInIntentBuilder()
578
- .setAvailableProviders(Arrays . asList(new IdpConfig .Builder (AuthUI . EMAIL_PROVIDER ). build(),
579
- googleIdp,
580
- new IdpConfig .Builder (AuthUI . FACEBOOK_PROVIDER ). build()))
581
- .build(),
582
- RC_SIGN_IN );
578
+ AuthUI . getInstance()
579
+ .createSignInIntentBuilder()
580
+ .setAvailableProviders(Arrays . asList(googleIdp, ... ))
581
+ .build(),
582
+ RC_SIGN_IN );
583
583
```
584
584
585
585
586
586
### Facebook
587
587
588
588
By default, FirebaseUI requests the ` email ` and ` public_profile ` permissions when initiating
589
589
Facebook Login. If you would like to request additional permissions from the user, call
590
- ` setPermissions ` on the ` AuthUI.IdpConfig.Builder ` when initializing FirebaseUI.
590
+ ` setPermissions ` on the ` AuthUI.IdpConfig.FacebookBuilder ` when initializing FirebaseUI.
591
591
592
592
``` java
593
593
// For a list of permissions see:
594
- // https://developers.facebook.com/docs/facebook-login/android
595
594
// https://developers.facebook.com/docs/facebook-login/permissions
596
595
597
- AuthUI . IdpConfig facebookIdp = new AuthUI .IdpConfig .Builder ( AuthUI . FACEBOOK_PROVIDER )
598
- .setPermissions(Arrays . asList(" user_friends" ))
599
- .build();
596
+ AuthUI . IdpConfig facebookIdp = new AuthUI .IdpConfig .FacebookBuilder ( )
597
+ .setPermissions(Arrays . asList(" user_friends" ))
598
+ .build();
600
599
601
600
startActivityForResult(
602
- AuthUI . getInstance()
603
- .createSignInIntentBuilder()
604
- .setAvailableProviders(Arrays . asList(new AuthUI .IdpConfig .Builder (AuthUI . EMAIL_PROVIDER ). build(),
605
- facebookIdp))
606
- .build(),
607
- RC_SIGN_IN );
601
+ AuthUI . getInstance()
602
+ .createSignInIntentBuilder()
603
+ .setAvailableProviders(Arrays . asList(facebookIdp, ... ))
604
+ .build(),
605
+ RC_SIGN_IN );
608
606
```
609
607
610
608
### Twitter
0 commit comments