I developed a game in android. I tried to implement the GooglePlay SignIn but it shows an error. I'm not able to debug this error. I tried installing the app in different phone models other than emulators.
Code:
public void startSignInIntent() {
startActivityForResult(mGoogleSignInClient.getSignInIntent(), RC_SIGN_IN);
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
if (requestCode == RC_SIGN_IN) {
Task<GoogleSignInAccount> task =
GoogleSignIn.getSignedInAccountFromIntent(intent);
try {
GoogleSignInAccount account = task.getResult(ApiException.class);
} catch (ApiException apiException) {
String message = apiException.getMessage();
if (message == null || message.isEmpty()) {
message = getString(R.string.signin_other_error);
}
new AlertDialog.Builder(this)
.setMessage(message)
.setNeutralButton(android.R.string.ok, null)
.show();
}
}
super.onActivityResult(requestCode, resultCode, intent);
}
EDIT
Now after following the suggested methods, the SignIn dialogue closes immediately without showing any errors.

