Code for Google provider

Now that we have all the necessary settings in place, the following piece of code helps in initializing Google Sign-in for your project:

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());    return providers;}private void authenticate() {    startActivityForResult(            AuthUI.getInstance().createSignInIntentBuilder()                    .setAvailableProviders(getAuthProviderList())                    .setIsSmartLockEnabled(false)                    .build(),            REQUEST_CODE);}

This code is self-explanatory, as we have just one line of code to enable Google Sign-in. We also have ...

Get Mastering Firebase for Android Development now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.