How to do it...

To save you the hassle of creating the connection button and wiring the button and metadata, Firebase offers the powerful Firebase UI for Android, where it will help us create the basic UI and wire up everything for us out of the box. So let's see how we can make it happen.

  1. In your login activity, add the following variable declarations: 
       private static final int RC_SIGN_IN = 17;       FirebaseAuth auth;
  1. Next, in your onCreate() method, add the following : 
      auth = FirebaseAuth.getInstance();      if(auth.getCurrentUser() != null) {     Log.d("Auth", "Logged in successfully");     } else {      startActivityForResult(            AuthUI.getInstance()                    .createSignInIntentBuilder()                    .setAvailableProviders(                      Arrays.asList(                             new     AuthUI.IdpConfig.Builder(AuthUI. ...

Get Firebase Cookbook now with the O’Reilly learning platform.

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