My Firebase verification emails work just fine. However, as soon as I try add actionCodeSettings
they don't. The issue may be the url that I set, given that I don't know what I should actually be setting this to.
What I am trying to achieve is that when a link is clicked on, on the Android device on which the app is installed, it bounces the user back to the app.
If clicked anywhere else then nothing other than the usual message stating that the account is verified needs to happen.
How should I be using actionCodeSettings
to get this behaviour?
String url = "com.app/verify?uid=" + user.getUid();
ActionCodeSettings actionCodeSettings = ActionCodeSettings.newBuilder()
.setUrl(url)
.setAndroidPackageName("com.app", false, null)
.build();
user.sendEmailVerification(actionCodeSettings)
.addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()) {
Log.d(TAG, "Email sent.");
Toast.makeText(MainActivity.this, "Registration successful. Please verify your account by clicking on the link sent to your email address.",
Toast.LENGTH_LONG).show();
}else {
Log.d(TAG, "Email not sent");
Toast.makeText(MainActivity.this, "Registration successful. However, verification email could not be send.",
Toast.LENGTH_LONG).show();
}
}
});