@@ -291,6 +291,7 @@ startActivityForResult(
291
291
292
292
##### Phone number authentication customization
293
293
294
+ ###### Setting a default phone number
294
295
When using the phone verification provider and the number is known in advance, it is possible to
295
296
provide a default phone number (in international format) that will be used to prepopulate the
296
297
country code and phone number input fields. The user is still able to edit the number if desired.
@@ -301,7 +302,7 @@ IdpConfig phoneConfigWithDefaultNumber = new IdpConfig.PhoneBuilder()
301
302
.build();
302
303
```
303
304
304
- Alternatively, you can set only the default phone number country.
305
+ Alternatively, you can set the default country (alpha-2 format) to be shown in the country selector .
305
306
306
307
``` java
307
308
IdpConfig phoneConfigWithDefaultNumber = new IdpConfig .PhoneBuilder ()
@@ -319,6 +320,45 @@ IdpConfig phoneConfigWithDefaultNumber = new IdpConfig.PhoneBuilder()
319
320
.build();
320
321
```
321
322
323
+ ###### Limiting the list of available countries in the country selector
324
+
325
+ You can limit the countries shown in the country selector list. By default, all countries are shown.
326
+
327
+ You can provide a list of countries to whitelist or blacklist. You can populate these lists with
328
+ ISO (alpha-2) and E164 formatted country codes.
329
+
330
+ ``` java
331
+ List<String > whitelistedCountries = new ArrayList<String > ();
332
+ whitelistedCountries. add(" +1" );
333
+ whitelistedCountries. add(" gr" );
334
+
335
+ IdpConfig phoneConfigWithWhitelistedCountries = new IdpConfig .PhoneBuilder ()
336
+ .setWhitelistedCountries(whitelistedCountries)
337
+ .build();
338
+ ```
339
+ All countries with the country code +1 will be present in the selector as well as Greece ('gr').
340
+
341
+ You may want to exclude a few countries from the list and avoid creating a whitelist with
342
+ many countries. You can instead provide a list of countries to blacklist. By doing so, all countries
343
+ excluding the ones you provide will be in the selector.
344
+
345
+ ``` java
346
+ List<String > blacklistedCountries = new ArrayList<String > ();
347
+ blacklistedCountries. add(" +1" );
348
+ blacklistedCountries. add(" gr" );
349
+
350
+ IdpConfig phoneConfigWithBlacklistedCountries = new IdpConfig .PhoneBuilder ()
351
+ .setBlacklistedCountries(blacklistedCountries)
352
+ .build();
353
+ ```
354
+
355
+ The country code selector will exclude all countries with a country code of +1 and Greece ('gr').
356
+
357
+ Note: You can't provide both a list of countries to whitelist and blacklist. If you do, a runtime
358
+ exception will be thrown.
359
+
360
+ #####
361
+
322
362
### Handling the sign-in response
323
363
324
364
#### Response codes
0 commit comments