Android TutorialsNo Comments

default thumbnail
1736 views.

If you want to signup with google account first of all need to create project in console. below we discuss everything.

Creating a Project at Google Developers Console

Log in to Google Plus account and go to this link and click on create project.

g

Now fill the details and click on create.

new-project

Now we need a configuration file for our android app. So go to this link. Select your app we just created on developer console. And write the package name of your android studio project we created. Finally choose country and click on continue.

google-developers

In the next screen you will asked for SHA-1. To get SHA-1 Certificate. Open command prompt and navigate to jdk/bin folder. Write the following command and hit enter

Note: Make sure you have changed c:\users\belal\ with c:\users\your_user_name in the above command

sha-1

Copy the SHA1 and paste it to the Enable Google Services Page.

enable-google-signin

Now click on Enable Google Signin. And click on Continue to Generate Configuration Files. Now click on download google-services.json to get your configuration file. Now come to android studio.

Google Login Android Project
Copy the json configuration file (you just downloaded) and paste it inside your google login android studio project (Inside app/ directory).
Open the Top Level build.gradle file and add the following line inside dependencies.

Inside build.gradle file add the following dependencies and sync your google login android project.

The second line is for adding volley. I will use volley to load user’s profile image in this tutorial.
Now come to activity_main.xml.

As you can see I have created a google plus login button with two TextView (to show name and email) and a NetworkImageView (to show profile pic).
Now come to MainActivity.java and write the following code.

For loading image from URL I have used a Custom Volley Request from an old tutorial Load Image from Internet Using Volley. For the custom volley request you have to create the following class.

Now add internet permission to your manifest and  run your google login android application.

droidscreen-1

Be the first to post a comment.

Add a comment