The quickest and easiest way of integrating user registration in your application is through existing social networks such as Google, Facebook, VK and etc.. In this tutorial, I’m going to teach you how to implement Google Plus Sign In using Android.

Google Plus is a social network provided by Google. Google Plus Sign In lets your users sign in  their existing Google account in your Android app. Once integrated, you’ll be able to get their basic information such as name, email, display picture, gender and other details. Using Google Sign-In makes your registration process easier and more comfortable to users since they will no longer input their information manually. You also don’t need to validate if the email used by the user is legit since it’s already connected to Google.


Before we can use Google Sign-In in our application, we need to do the following steps.

1.) Update your Android Support Repository, Google Play Services, and Google Repository in your SDK manager.


2.) Create a new project in Google Developer Console. You can quickly add new project here: Google Developer Link


Click GET STARTED then choose Android App.


Provide the form with the name of your app and package name then select your country/region.


Select Google Sign In and provide your app’s SHA-1 certificate.


The quickest way to get your SHA-1 certificate is to generate a signing report. You can find it in your gradle properties.


That’s it! We can now integrate Google Plus Sign-in in our Android app. Now open the project that you used earlier and create new packages and classes just like what you see below.


Then add these dependencies in your build.gradle so that we can use Google sign in.


Next is to add this permission in your AndroidManifest.xml.


We’ll get three information when a user logged in. Their Google unique id, name and email. First we create a model where we can store these information. Open then add the following codes.


Next Open then add the following codes. I’ve store all the shared preference keys here so we can use it in other classes.


When a user logged in, we need to save its current information in a shared preference so that our app can check if a user is logged in or not. Open then add the following codes.


Now there are some variables that needs to be accessed in different activities. One solution for this is to make them globally available by creating a singleton class. A singleton in Java is a class for which only one instance can be created. It provides a global point of access this instance. Open and add the following codes.


Then open AndroidManifest.xml and add this in the application tag.


Now let’s add the Google sign-in button in our login activity. Open activity_login.xml then add the following layout codes.


Then open your and add the following codes. I’ve put some comments so you can understand the codes provided.


Then open activity_home.xml then add the following layout codes.


Lastly, open and add the following codes. We’ll display the user’s information here. We also have a sign out and revoke access button here.


Now you can run and test you app if it is working. The final output of this tutorial should be like this.

Login activity

Selecting Google account

Home activity

If you’re having trouble reaching up to this point, then you can download the full source code here: Download Link