How to add Google sign-in to your app
A Google sign-in allows your users to sign in to your application using their Google credentials. This recipe will walk you through the process of adding a Google sign-in to your application. Here's a screenshot showing the Google sign-in button in the application that we'll create in the recipe:
Getting ready
Create a new project in Android Studio and call it GoogleSignIn
. Use the default Phone & Tablet option and select Empty Activity when prompted for Activity Type.
The Google sign-in uses the Google Services plugin, which requires a Google Services Configuration file, which is available from the Google Developer Console. To create the configuration file, you will need the following information:
- Your application package name
- Your signing certificate's SHA-1 hash code (see the Authenticating Your Client link at the end of the recipe for more information)
When you have the information, log in to this Google link and follow the wizard to...