I struggled with this for a while - and many times I searched for answers to them, but did not find it (so I apologize if I missed the resolution). I implement the "Log in to Google" button / logic and everything works fine EXCLUDES when it comes to changing the orientation of the device. In this case, I am provided with several copies of the Google rights dialog. (So if I change the orientation three times, there are three copies of the dialog box with the permissions that I must cancel before returning to the original screen). (An example of a dialog with permissions can be found here ).
It seemed to me that I too complicated the code, so I did a new kind of activity using the code from Google tutorials ( Getting Started / Sign-In ), and I still have the same problem. (Code below)
(FWIW, I also tried to create a new action using the IntelliJ function "New → Activity → Login Activity" with the same results.)
In addition to this, I tried to launch the Google Quick Start application and yes, the same problem is still happening!
Has anyone else successfully implemented “Sign in to Google" WITHOUT this behavior? I suppose, as a last resort, I could make my authentication operation always appear in the portrait, but I'm trying to figure out if there is permission for this.
Thank you in advance!
Below is my code from my "simplified" operation:
package com.myapp.test.view.housekeeping; import android.content.Intent; import android.content.IntentSender; import android.os.Bundle; import android.support.v7.app.ActionBarActivity; import android.view.View; import android.widget.Toast; import com.myapp.test.R; import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.api.GoogleApiClient; import com.google.android.gms.plus.Plus; public class AuthenticateActivity_BareBones extends ActionBarActivity implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener { private static final int RC_SIGN_IN = 1; private GoogleApiClient mGoogleApiClient; private boolean mIntentInProgress; private boolean mSignInClicked; private ConnectionResult mConnectionResult; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_authenticate); mGoogleApiClient = new GoogleApiClient.Builder(this) .addConnectionCallbacks(this) .addOnConnectionFailedListener(this) .addApi(Plus.API) .addScope(Plus.SCOPE_PLUS_LOGIN) .build(); } @Override protected void onStart() { super.onStart(); mGoogleApiClient.connect(); } @Override protected void onStop() { super.onStop(); if (mGoogleApiClient.isConnected()) { mGoogleApiClient.disconnect(); } } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); switch (requestCode) { case RC_SIGN_IN: if (resultCode != RESULT_OK) { mSignInClicked = false; } mIntentInProgress = false; if (!mGoogleApiClient.isConnecting()) { mGoogleApiClient.connect(); } break; } } public void onButtonClick(View view) { int id = view.getId(); switch (id) { case R.id.login_authenticate_google_button: if (!mGoogleApiClient.isConnecting()) { mSignInClicked = true; resolveSignInError(); } break; } } @Override public void onConnected(Bundle connectionHint) {
source share