I am using firebaseUI for authentication. it essentially opens a a external activity and logs the user into firebase and sends the developer a call back in onActivityResult.
public boolean isNewSignUp(){
FirebaseUserMetadata metadata = mAuth.getCurrentUser().getMetadata();
return metadata.getCreationTimestamp() == metadata.getLastSignInTimestamp();
}
At the time of writing, Looks like each logged in user has meta data as i suspected. we can check the last sign time to know if its a new account. I heard they will be making this easier in the future, check later versions of firebase authentication before attempting this.
Do not use the creation and sign in timestamp comparison. I found it to be unreliable.
IdpResponse
has a isNewUser()
method to tell you whether the login is a new account or not.