How can I validate user is already signed up?
private void firebaseAuthWithGoogle(final GoogleSignInAccount acct, final GoogleSignInResult result) {
AuthCredential credential = GoogleAuthProvider.getCredential(acct.getIdToken(), null);
mAuth.signInWithCredential(credential)
.addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()) {
//HOW CAN I validate user is already signup or not
if (Singup == true) {
did not create account.
} else {
create account;
}
} else {
// If sign in fails, display a message to the user.
Log.w(TAG, "signInWithCredential:failure", task.getException());
Toast.makeText(Login.this, "Authentication failed.",
Toast.LENGTH_SHORT).show();
// updateUI(null);
}
}
});
}
This is creating account when user already exists or not every time.