Google+ sign out from a different activity

前端 未结 9 1700
终归单人心
终归单人心 2020-12-05 00:17

I have started using the Google+ API for android, and I have created a sign-in application following this tutorial:

https://developers.google.com/+/mobi

9条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-05 00:32

    Once you click logout from another activity,try send an intent with extra to indicate that logout button is clicked. Then on Login Activity

    if (Intent.Extras != null && Intent.Extras.ContainsKey("LogoutAction")) {
        _logoutRequest = Intent.Extras.GetBoolean("LogoutAction");
    }
    if (_logoutRequest) {
        await PlusClass.AccountApi.RevokeAccessAndDisconnect(_apiClient);
        _apiClient.Disconnect();
        _apiClient.Connect ();
        _logoutRequest = false;
    }
    

    Other Activity

    var intent = new Intent(this.Activity,typeof(LoginActivity));
    intent.PutExtra("LogoutAction",true);
    

提交回复
热议问题