When users signup using the Firebase Email/Password SIGN-IN METHOD
in android, how can we verify their Emails ?
For Android Email verification, first you can view the documentation by firebase here.
Send a user a verification email
FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
user.sendEmailVerification()
.addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()) {
Log.d(TAG, "Email Sent.");
}
}
});
In my App whenever a user registers, sendEmailVerification();
is triggered
private void sendEmailVerification() {
FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
user.sendEmailVerification()
.addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()) {
Log.d(TAG, "Email verification sent.");
}
}
});
}
Using the previous method, your users will now be provided with a verification Email. And it will look something a lot like this
Did they verify their email ?
private void IsEmailVerified() {
FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
if (user.isEmailVerified()) {
Log.d(TAG, "Email is verified.");
} else {
Log.d(TAG, "Email is not verified !.");
}
}
Sadly, you may not customize the content/body of your verification Email ( I have been heavily corresponding with Firebase to provide alternative less hideous looking templates ). You may change the title or the message sender ID, but that's all there is to it.
Not unless you relink your application with your own supported Web. Here.