上QQ阅读APP看书,第一时间看更新
Project configuration
Go to Firebase console and inside the authentication window, go to sign-in method and enable phone number sign- in. Now, we need to add the phone number provider inside the getAuthProviderList method:
private List<AuthUI.IdpConfig> getAuthProviderList() {
List<AuthUI.IdpConfig> providers = new ArrayList<>();
providers.add(
new AuthUI.IdpConfig.Builder(AuthUI.EMAIL_PROVIDER).build());
providers.add(new
AuthUI.IdpConfig.Builder(AuthUI.GOOGLE_PROVIDER).build());
providers.add(new
AuthUI.IdpConfig.Builder(AuthUI.FACEBOOK_PROVIDER).build());
providers.add(new
AuthUI.IdpConfig.Builder(AuthUI.TWITTER_PROVIDER).build());
providers.add(new
AuthUI.IdpConfig.Builder(AuthUI.PHONE_VERIFICATION_PROVIDER).build());
return providers;
}
Now that we have successfully integrated phone number verification into the application, let's compile the output:
This screenshot shows the successful integration of the FirebaseUI for phone number sign-in.