Skip to main content

Enabling Sign-in APi in Google Developer console

We need to enable Sign-in Api for our application in google developers console to use google sign-in  in our application.

1 . first we need to create a project in google developers console
    visit google developers  console 
     https://console.developers.google.com/project
2 . Click on create project button you will see the below screen
   
3 . Enter project name and click CREATE . Then we are directed to project home page  which will look like this

4 . Next we need to add Google API to our project. click on library on left menu and search for google api
5 . Configure  OAuth consent screen , click on 'OAuth consent screen'
 6 . Enter Application name and email id everything else is optional and click save


 7 . Configure Credentials 
      Google uses this to ensure that your application is not fake application . For the purpose of development we use debug certificate. When we deploy our app on play store we need real certificate, steps for geeting it is 
https://developer.android.com/tools/publishing/app-signing.html
we only need debug certificate for development , it is identified by SHA1 fingerprint 
Steps for getting SHA1
  I . SHA1 can be accesed from debug keystore
      on mac or linux it is in the ~/.android directory
      on windows it is in the c/user/<username>/.android directory
 II . Run the following  command
      on mac/linux open terminal 
keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android
      on windows 
keytool -list -v -keystore C:\Users\arun\.android\debug.keystore -alias androiddebugkey -storepass android
 III . you will get output like this 
  you can find SHA1 in the output
  If you are not getting output and getting the error in windows
 "keytool is not recognized as internal or external command "
  click on following link
  keytool is not recognized as internal or external commad
now we got our SHA1 , so we can configure credentials
8 . Click o credentials on the left side and you will be asked to create credentials

9 . Click on create credentials , now you will be asked to select a access method select OAuth client ID
10 . Next you will get a screen like this
11 . Select android and enter Name,Package name and SHA1. Package name should be same as your application package name
 12 . click on create and your client id will be ready
13 . now you can start coding for your application with google sign in.
click here for creating android  app with google sign-in
Google sign-in in android app

Comments

Popular posts

Simple Calculator in Android

You can view new updated simple calculator with ViemModel and LiveData in my new blog    https://androidtuts4u.blogspot.com/2021/10/simple-calculator-with-viewmodel-and.html To create a calculator first  we need to create the layout of the calculator. Layout  is created  using XML file given below <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:tools="http://schemas.android.com/tools"     android:layout_width="match_parent"     android:layout_height="match_parent" >  <EditText     android:id="@+id/result_id"       android:layout_width="fill_parent"     android:layout_height="120dp"   />  <Button    android:id="@+id/Btn7_id"      android:layout_width="70dp"    android:layout_height="60dp"    android:layout_below="@id/result_id"   ...

Keytool is not recognized as internal or extenal command / Adding PATH in system variable

If you are running a keytool command  keytool -list -v -keystore C:\Users\arun\.android\debug.keystore -alias androiddebugkey -storepass android    and getting an error   'keytool' is not recognized as an internal or external command  If you are using any other commad like java,javac , etc.. and getting an error " is not recognized as an internal or external command"  you can also use this same steps  you are getting this error because keytool.exe , executable file which exists in the bin directory of your JDK  is not added to Path in your Environmental variables. To resolve this issue 1 .first we need to find the bin Directory of our jdk    Usually this will be in  C:\Program Files\Java\jre1.8.0_221\bin (jre1.8.0_221 - change this to your latest version , ). you can see keytool.exe file in the bin directory . (If you installed jdk in a different directory Find your Jdk installation folder and  use that path....

Android Sqlite and ListView Example

This is simple application which insert data into Sqlite database --and shows the data  from the database in a ListView ListView is not used in android Anymore . We use RecyclerView and CardView   in Android RecyclerView Demo is available on the following link http://androidtuts4u.blogspot.in/2017/04/android-recyclerview-example.html RecyclerView with CardView Demo is available on the following link http://androidtuts4u.blogspot.in/2017/09/android-card-view-example.html This  is the first Activity of application which shows data from database in listview. Register here buton will start a Registration Activity. Submit button will add data to database and show it in the ListView of MainActivity. Update can be performed by clicking ListView items.     you can download the source code of this project from  google drive   https://drive.google.com/folderview?id=0BySLpWhqmbbdS0dtT1R2TXdBWEE&usp=sharing click on the abov...