O'Reilly logo

Mastering Firebase for Android Development by Ashok Kumar S

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required