How to check whether a user has signed-in Google+?

前端 未结 3 1559
滥情空心
滥情空心 2021-01-02 03:32

I am writing an app which requires user login.

I would like to implement it by Google+ and have followed the following articles to set-up my login activity Log

3条回答
  •  长发绾君心
    2021-01-02 04:04

    Connect a GoogleApiClient in your MainActivity as normal, but in the onConnectionFailed instead of storing the result or resolving the error enable the sign in button. When the user clicks that, start your LoginActivity, which should also implement GoogleApiClient and related interfaces, and do all of your ConnectionResult handling from there.

    You might find it easier if you create a base activity that does the GoogleApiClient setup that both your activities implement. It's totally fine to have the GoogleApiClient connection started on each activity - its designed to be used that way.

提交回复
热议问题