I'm trying to implement the saved games codes, I can save and load without problems, all the data is OK. But I when I connect with Google, the code connect with a default account. I try to use account picker and use the returned mail but the account was the same, same data. I need select the account or my code is useless.
This is my connect code:
public static void conectarGoogle(final FragmentActivity a) {
GoogleApiClient.ConnectionCallbacks connectionCallbacks = new GoogleApiClient.ConnectionCallbacks() {
@Override
public void onConnected(@Nullable Bundle bundle) {
Log.d(TAG,"conected");
}
@Override
public void onConnectionSuspended(int i) {
mGoogleApiClient.connect();
}
};
GoogleApiClient.OnConnectionFailedListener cfl = new GoogleApiClient.OnConnectionFailedListener() {
@Override
public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
Log.d(TAG,"failed="+connectionResult.toString());
mIsResolving = BaseGameUtils.resolveConnectionFailure(a, mGoogleApiClient, connectionResult, RC_SIGN_IN, a.getString(R.string.signin_other_error));
}
};
mGoogleApiClient = new GoogleApiClient.Builder(a)
.addConnectionCallbacks(connectionCallbacks)
.addOnConnectionFailedListener(cfl)
.addApi(Games.API)
.addScope(Games.SCOPE_GAMES)
.addScope(Drive.SCOPE_APPFOLDER)
.setViewForPopups(a.findViewById(android.R.id.content))
.build();
mGoogleApiClient.connect();
}
public static void desconectarGoogle(){
if(mGoogleApiClient!=null && isSignedIn()) {
mGoogleApiClient.disconnect();
}
}
I need help for this problem. I use this code in mainactivity and preferencesactivity and cant select the account for save the progress.
- The default account use the marchinglord2524 name.
- The Games.API dont left add Auth.GOOGLE_SIGN_IN_API.