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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.