Google Sign in but result code is 0
Try checking if you have the correct OAuth key properly configured for your app. According to this related SO post, the OP noticed that the Auth key is also associated with other project that create the issue.
Also you can check the following implementation of Try Sign-In for Android, for code implementation:
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
// Result returned from launching the Intent from GoogleSignInClient.getSignInIntent(...);
if (requestCode == RC_SIGN_IN) {
// The Task returned from this call is always completed, no need to attach
// a listener.
Task<GoogleSignInAccount> task = GoogleSignIn.getSignedInAccountFromIntent(data);
handleSignInResult(task);
}
}
Also, some additional information provided by OP, you need to make sure you have signed the APK when you are testing it. See the documentation about Sign Your App for detailed information about it.
Hope this helps.
I've had the same bug, requestCode was always 0 (RESULT_CANCELED).
Decision was to enable google sign in in firebase console.
Firebase console -> Your project -> Authentication -> Providers -> Google -> and switch it on.
In my case link was like this
https://console.firebase.google.com/u/0/project/{PROJECT NAME}/authentication/providers