public class

GoogleSignInClient

extends Object
java.lang.Object
   ↳ com.neomades.googlesignin.GoogleSignInClient

Class Overview

A client for interacting with the Google Sign In API.

Cross-Platform considerations

Available only for Android.

Summary

Public Methods
void revokeAccess(GoogleSignInCompletionListener listener)
Revokes access given to the current application.
void signIn(GoogleSignInCompletionListener listener)
Launches the process to sign in a user.
void signOut(GoogleSignInCompletionListener listener)
Signs out the current signed-in user if any.
void silentSignIn(GoogleSignInCompletionListener listener)
Returns the GoogleSignInAccount information for the user who is signed in to this app.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public void revokeAccess (GoogleSignInCompletionListener listener)

Revokes access given to the current application. Future sign-in attempts will require the user to re-consent to all requested scopes. Applications are required to provide users that are signed in with Google the ability to disconnect their Google account from the app. If the user deletes their account, you must delete the information that your app obtained from the Google APIs.

Parameters
listener A listener that may be used to check for failure, success or completion

public void signIn (GoogleSignInCompletionListener listener)

Launches the process to sign in a user. Since a system UI is required for the user to select its account, you must pass the current screen of your application when calling this method.

Parameters
listener A listener that may be used to check for failure, success or completion

public void signOut (GoogleSignInCompletionListener listener)

Signs out the current signed-in user if any. It also clears the account previously selected by the user and a future sign in attempt will require the user pick an account again.

Parameters
listener A listener that may be used to check for failure, success or completion

public void silentSignIn (GoogleSignInCompletionListener listener)

Returns the GoogleSignInAccount information for the user who is signed in to this app. If no user is signed in, try to sign the user in without displaying any user interface.

The GoogleSignInAccount will possibly contain an ID token which may be used to authenticate and identify sessions that you establish with your application servers. If you use the ID token expiry time to determine your session lifetime, you should retrieve a refreshed ID token, by calling silentSignIn prior to each API call to your application server.

Calling silentSignIn can also help you detect user revocation of access to your application on other platforms and you can call signIn(GoogleSignInCompletionListener) again to ask the user to re-authorize.

If your user has never previously signed in to your app on the current device, we can still try to sign them in, without displaying user interface, if they have signed in on a different device.

We attempt to sign users in if:

  • There is one and only one matching account on the device that has previously signed in to your application
  • the user previously granted all of the scopes your app is requesting for this sign in.

Parameters
listener A listener that may be used to check for failure, success or completion