Android App Development
iOS App Development
Flutter App Development
Cross Platform App Development
Hire on-demand project developers and turn your idea into working reality.
Big thanks to Webkul and his team for helping get Opencart 3.0.3.7 release ready!
Deniel Kerr
Founder. Opencart
Top Partners
In this blog, We are going to show you how to integrate the google sign-in in your android application.
Google+ sign-in allow users to sign-in by your Android app with their existing Google account and get their profile information like name, email, profile pic and other details.
The main advantage of integrating G+ login is, you can encourage more users to your app by providing fast & easiest way of a registration process.
There are some requirements which is necessary while integrating g+
Step 1: Enable google+ API and Get configuration file
go to this link
Click on Get A Configuration file button
After clicking this button you have to Enable google service for your app with the application name and package name.
After fulfilling the above requirements click to Continue blue button.
You have to select the service that which service you want to add in your app.
Before Creating the configuration file We can Enable the Google Sign-In API,
And for enabling google sign-in api you have to provide the SHA-1 of your signing certificate:
For Windows:
For Mac/Linux:
The keytool utility prompts you to enter a password for the keystore. The default password for the debug keystore is android.
android
Example:
After Generating the SHA- 1
You can enable the Google Sign-in API
For more information: Signing your App
Then generate the google-services.json file. And download it.
Step 2: Add this configuration file to your project.
Copy the google-services.json file you just downloaded into the app/ or mobile/ directory of your Android Studio project.
google-services.json
app/
mobile/
Step 3: Add permission to your manifest.xml
Step 4: Add a plugin to your project in your top-level build.gradle and your app-level build.gradle files as follows:
build.gradle
1- In your sign-in activity’s onCreate method, configure Google Sign-In to request the user data required by your app
onCreate
Configure sign-in to request the user’s ID, email address, and basic profile. ID and basic profile are included in DEFAULT_SIGN_IN.
2- Build a GoogleApiClient with access to the Google Sign-In API and the options specified by gso.
1- Add the SignInButton in your application’s layout:
2- If you want to customize the button’s size and color scheme. Then google gives the methods to customize:
3- In the Android activity (for example, in the onCreate method), register your button’s OnClickListener to sign in the user when clicked:
OnClickListener
1- Simply call the function after clicking the sign-in button
2- In the activity’s onActivityResult method, retrieve the sign-in result with getSignInResultFromIntent.
onActivityResult
getSignInResultFromIntent
3- After you get the sign-in result,
You can get the profile information.
Your email address will not be published. Required fields are marked*
Name*
Email*
Save my name email and website in this browser for the next time I comment.
Be the first to comment.
We use cookies to personalize your experience. By continuing to visit this website you agree to our use of cookies. Learn more about privacy policy
Great Product, Great Team, and Great Support Service. And if you want to add more features to the product, they can submit any idea that comes to your mind. They really care about their clients and we are really happy and honored to deal with Webkul.
Osama
USA
India
Global
Name
Email
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.