且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Android的API IsConnected注销后返回TRUE

更新时间:2023-12-02 12:32:40

为了保持登录的状态同步增长就必须实现onActivityResult正常。

In order to keep signed-in state synced up you MUST implement onActivityResult properly.

这看起来应该是如下:

请注意:这是java的code,我不知道这将如何看起来完全使用Xamarin,但希望你应该能够理解它:)

NOTE: this is java code, I am not sure how this will look exactly using Xamarin, but hopefully you should be able to figure it out :)

@Override
protected void onActivityResult(int requestCode, int responseCode, Intent data) {

    // check for "inconsistent state"
    if ( responseCode == GamesActivityResultCodes.RESULT_RECONNECT_REQUIRED && requestCode == <your_request_code_here> )  {  

       // force a disconnect to sync up state, ensuring that mClient reports "not connected"
       mGoogleApiClient.disconnect();
    }
}

请注意:只要确保替换code与你使用的请求code。您可能需要检查多个请求codeS了。

NOTE: just make sure to replace in the code with the request code you used. You may need to check for multiple request codes too.