Android Google Sign In: check if User is signed in

前端 未结 3 2345
攒了一身酷
攒了一身酷 2021-02-05 07:43

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 s

3条回答
  •  庸人自扰
    2021-02-05 08:28

    Take a look at the Android sign-in documentation:

    To check if the user is signed-in, call isConnected():

    if (mGoogleApiClient != null && mGoogleApiClient.isConnected()) {
       // signed in. Show the "sign out" button and explanation.
       // ...
    } else {
       // not signed in. Show the "sign in" button and explanation.
       // ...
    }
    

提交回复
热议问题