title: Google + plus sign in not working after android 6 release
body: <p>So, before android 6 marshmallow release, google + sign in worked perfectly. After release, Im having issues like permissions, onConnectionFailed, etc... Does anybody has a solution how to fix this? Im calling google sign in methods from fragment. Here is the code:</p>
  
  <p>Fragment:</p>
  
  <pre><code> @Override
  public void onConnected(Bundle bundle) {
      Log.d("GoogleApiClient", "onConnected");
      mShouldResolve = false;
      new RetrieveTokenTask().execute(Plus.AccountApi.getAccountName(mGoogleApiClient));
  }
  
  @Override
  public void onConnectionSuspended(int i) {
      Log.d("GoogleApiClient", "onConnectionSuspended   " + String.valueOf(i));
  }
  
  @Override
  public void onConnectionFailed(ConnectionResult connectionResult) {
      Log.d("GoogleApiClient", "onConnectionFailed");
      Log.d("GoogleApiCLient", connectionResult.toString());
      ViewUtils.hideProgressDialog();
      if (!mIsResolving &amp;&amp; mShouldResolve) {
          if (connectionResult.hasResolution()) {
              try {
                  connectionResult.startResolutionForResult(getActivity(), RC_SIGN_IN);
                  mIsResolving = true;
              } catch (IntentSender.SendIntentException e) {
                  Log.e("LoginFragment", "Could not resolve ConnectionResult.", e);
                  mIsResolving = false;
                  mGoogleApiClient.connect();
              }
          }
      }
  }
  
  
  
  
  @Override
  public void onActivityResult(int requestCode, int resultCode, Intent data) {
      super.onActivityResult(requestCode, resultCode, data);
  
      Log.i("RequestCode", String.valueOf(requestCode));
      Log.i("ResultCode", String.valueOf(resultCode));
      try {
          Log.i("Intent", data.getAction());
      } catch (Exception e) {
      }
  
  
      if (requestCode == RC_SIGN_IN) {
          // If the error resolution was not successful we should not resolve further.
          ViewUtils.showProgressDialog(getActivity(), getActivity().getResources().getString(R.string.loading_dialog_str));
          if (resultCode != getActivity().RESULT_OK) {
              mShouldResolve = false;
          }
  
          mIsResolving = false;
          mGoogleApiClient.connect();
          if (mGoogleApiClient.isConnected()) {
              new RetrieveTokenTask().execute(Plus.AccountApi.getAccountName(mGoogleApiClient));
          }
  
      } else {
          //facebook
          Log.d("Login", "FaceBook");
          mCallbackManagerFacebook.onActivityResult(requestCode, resultCode, data);
      }
  
  
  }
  private class RetrieveTokenTask extends AsyncTask&lt;String, Void, String&gt; {
  
      private static final String TAG = "RetrieveAccessToken";
      private static final int REQ_SIGN_IN_REQUIRED = 55664;
  
      @Override
      protected String doInBackground(String... params) {
          String accountName = params[0];
          String scopes = "oauth2:profile";
          String token = null;
          try {
              token = GoogleAuthUtil.getToken(getActivity(), accountName, scopes);
          } catch (IOException e) {
              Log.e(TAG, e.getMessage());
          } catch (UserRecoverableAuthException e) {
              startActivityForResult(e.getIntent(), REQ_SIGN_IN_REQUIRED);
          } catch (GoogleAuthException e) {
              Log.e(TAG, e.getMessage());
          }
          return token;
      }
  
      @Override
      protected void onPostExecute(String s) {
          super.onPostExecute(s);
          Log.d("Token", "Token Value: " + s);
          if (s == null) {
              ViewUtils.hideProgressDialog();
              ViewUtils.showToastMessage(getActivity(), getActivity().getResources().getString(R.string.login_error));
          } else {
              loginGoogleUser(s);
          }
  
  
          if (mGoogleApiClient.isConnected()) {
              Plus.AccountApi.clearDefaultAccount(mGoogleApiClient);
              mGoogleApiClient.disconnect();
          }
      }
  }
  </code></pre>
  
  <p>and activities on result:</p>
  
  <pre><code>@Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
      super.onActivityResult(requestCode, resultCode, data);
      LoginFragment loginFragment = (LoginFragment) getSupportFragmentManager().findFragmentByTag("MyProfileFragment");
      if (loginFragment != null) {
          loginFragment.onActivityResult(requestCode, resultCode, data);
      }
  }
  </code></pre>