I am looking for a way to check if my user already signed in with Google Sign In.
I support several logging APIs (Facebook, Google, custom), so I would like to build a static helper method like:
User.isUserLoggedIn()
With Facebook I use:
if AccessToken.getCurrentAccessToken() != null {
return true
}
to check if the user is logged via Facebook.
On iOS I use the following to check if the user is logged via Google Sign In:
GIDSignIn.sharedInstance().hasAuthInKeychain()
My question: Is there an equivalent on Android to the iOS method :
GIDSignIn.sharedInstance().hasAuthInKeychain()
?
I am looking for a method that doesn’t involve a callback.
Thanks! Max
Take a look at the Android sign-in documentation:
To check if the user is signed-in, call
isConnected()
:Implemented in Kotlin, and using Anko:
You can use this function
https://developers.google.com/android/reference/com/google/android/gms/auth/api/signin/GoogleSignIn