I have a problem with Google+ integration. I included Google+ in my application in the same way as the sample application did. For some reason, some users who log into Google+ disconnected after a while (maybe from several hours to several days), onConnectionFailed is called with the ConnectionResult.SIGN_IN_REQUIRED error code, although I know for sure that the user did not disconnect from Google+ in the application and mPlusClient .revokeAccessAndDisconnect (), mPlusClient.clearDefaultAccount (), and mPlusClient.disconnect () are never called. This error happens to too many people, so it’s hard for me to believe that the problem is that the user has signed up for their Google+ account.
This code exists in the base class of all my actions -
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mPlusClient = new PlusClient.Builder(this, this, this)
.setActions("http://schemas.google.com/AddActivity")
.build();
}
@Override
public void onStart() {
super.onStart();
mPlusClient.connect();
}
@Override
protected void onStop() {
mPlusClient.disconnect();
super.onStop();
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_CODE_SIGN_IN || requestCode == REQUEST_CODE_GET_GOOGLE_PLAY_SERVICES) {
if (resultCode == RESULT_OK && !mPlusClient.isConnected() && !mPlusClient.isConnecting()) {
mPlusClient.connect();
}
if (resultCode == RESULT_CANCELED)
userCanceledGoogleConnect();
}
}
any help would be much appreciated
source
share