@@ -216,16 +216,16 @@ You can enable sign-in providers like Google Sign-In or Facebook Log In by calli
216216
217217``` java
218218startActivityForResult(
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 );
229229```
230230
231231##### Adding a ToS and privacy policy
@@ -260,28 +260,30 @@ startActivityForResult(
260260 RC_SIGN_IN );
261261```
262262
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 ` :
265267
266268``` java
267269startActivityForResult(
268270 AuthUI . getInstance()
269271 .createSignInIntentBuilder()
270- .setIsSmartLockEnabled(! BuildConfig . DEBUG )
272+ .setIsSmartLockEnabled(false , true )
271273 .build(),
272274 RC_SIGN_IN );
273275```
274276
275- ###### Smart Lock hints
277+ ###### Smart Lock in dev builds
276278
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 :
279281
280282``` java
281283startActivityForResult(
282284 AuthUI . getInstance()
283285 .createSignInIntentBuilder()
284- .setIsSmartLockEnabled(false , true )
286+ .setIsSmartLockEnabled(! BuildConfig . DEBUG /* credentials */ , true /* hints */ )
285287 .build(),
286288 RC_SIGN_IN );
287289```
@@ -293,27 +295,27 @@ provide a default phone number (in international format) that will be used to pr
293295country code and phone number input fields. The user is still able to edit the number if desired.
294296
295297``` 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();
303309```
304310
305311It is also possible to set a default country code along with a national number if a specific country
306312is your app's target audience. This will take precedence over the full default phone number if both
307313are provided.
308314
309315``` 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();
317319```
318320
319321### Handling the sign-in response
@@ -560,50 +562,46 @@ at a diff of the `strings.xml` file before updating FirebaseUI.
560562
561563### Google
562564By default, FirebaseUI requests the ` email ` and ` profile ` scopes when using Google Sign-In. If you
563- would like to request additional scopes from the user, call ` setPermissions ` on the
564- ` AuthUI.IdpConfig.Builder ` when initializing FirebaseUI.
565+ would like to request additional scopes from the user, call ` setScopes ` on the
566+ ` AuthUI.IdpConfig.GoogleBuilder ` when initializing FirebaseUI.
565567
566568
567569``` java
568570// For a list of all scopes, see:
569571// https://developers.google.com/identity/protocols/googlescopes
570- AuthUI . IdpConfig googleIdp = new AuthUI .IdpConfig .Builder ( AuthUI . GOOGLE_PROVIDER )
571- .setPermissions (Arrays . asList(Scopes . GAMES ))
572- .build();
572+ AuthUI . IdpConfig googleIdp = new AuthUI .IdpConfig .GoogleBuilder ( )
573+ .setScopes (Arrays . asList(Scopes . GAMES ))
574+ .build();
573575
574576startActivityForResult(
575- AuthUI . getInstance()
576- .createSignInIntentBuilder()
577- .setAvailableProviders(Arrays . asList(new IdpConfig .Builder (AuthUI . EMAIL_PROVIDER ). build(),
578- googleIdp,
579- new IdpConfig .Builder (AuthUI . FACEBOOK_PROVIDER ). build()))
580- .build(),
581- RC_SIGN_IN );
577+ AuthUI . getInstance()
578+ .createSignInIntentBuilder()
579+ .setAvailableProviders(Arrays . asList(googleIdp, ... ))
580+ .build(),
581+ RC_SIGN_IN );
582582```
583583
584584
585585### Facebook
586586
587587By default, FirebaseUI requests the ` email ` and ` public_profile ` permissions when initiating
588588Facebook Login. If you would like to request additional permissions from the user, call
589- ` setPermissions ` on the ` AuthUI.IdpConfig.Builder ` when initializing FirebaseUI.
589+ ` setPermissions ` on the ` AuthUI.IdpConfig.FacebookBuilder ` when initializing FirebaseUI.
590590
591591``` java
592592// For a list of permissions see:
593- // https://developers.facebook.com/docs/facebook-login/android
594593// https://developers.facebook.com/docs/facebook-login/permissions
595594
596- AuthUI . IdpConfig facebookIdp = new AuthUI .IdpConfig .Builder ( AuthUI . FACEBOOK_PROVIDER )
597- .setPermissions(Arrays . asList(" user_friends" ))
598- .build();
595+ AuthUI . IdpConfig facebookIdp = new AuthUI .IdpConfig .FacebookBuilder ( )
596+ .setPermissions(Arrays . asList(" user_friends" ))
597+ .build();
599598
600599startActivityForResult(
601- AuthUI . getInstance()
602- .createSignInIntentBuilder()
603- .setAvailableProviders(Arrays . asList(new AuthUI .IdpConfig .Builder (AuthUI . EMAIL_PROVIDER ). build(),
604- facebookIdp))
605- .build(),
606- RC_SIGN_IN );
600+ AuthUI . getInstance()
601+ .createSignInIntentBuilder()
602+ .setAvailableProviders(Arrays . asList(facebookIdp, ... ))
603+ .build(),
604+ RC_SIGN_IN );
607605```
608606
609607### Twitter
0 commit comments