注销用户

Sign out the user

Here在Google提供的代码示例中connect方法是在disconnect方法之后直接调用的。

@Override
public void onClick(View view) {
  if (view.getId() == R.id.sign_out_button) {
    if (mGoogleApiClient.isConnected()) {
      Plus.AccountApi.clearDefaultAccount(mGoogleApiClient);
      mGoogleApiClient.disconnect();
      mGoogleApiClient.connect();
    }
  }
}

描述的代码片段应该用于让用户退出 Google+。为什么他们又重新连接了?

那个代码示例有错吗?如果不是,那么解释是什么?如果未登录,connect 方法的真正作用是什么?!

因为你是在断开后立即连接

mGoogleApiClient.disconnect();
mGoogleApiClient.connect(); #Remove this part

这是他们网站的一个错误。

接受的答案是错误的。这不是错误。当您从 Google plus 注销时,您会看到再次选择另一个或相同帐户的选项。这就是为什么在 disconnected.It 之后再次调用 mGoogleApiClient.connect() 不会自动让你重新登录,它只是要求你选择一个帐户来退出。