不会发送Firebase确认电子邮件

时间:2016-10-25 00:41:24

标签: android firebase firebase-authentication

private FirebaseAuth firebaseAuth;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sign_up);

firebaseAuth=FirebaseAuth.getInstance();

firebaseAuth.addAuthStateListener(new FirebaseAuth.AuthStateListener() {
    @Override
    public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
        if(firebaseAuth.getCurrentUser()!=null){
            Log.d("user","a user has logged in");    //tried calling sendEmailVerification here
        }
        else{
            Log.d("user","user has logged out");
        }
    }
});
.........
}

public void signUpButtonClick(View view){
//after making sure that the user entered email and password
firebaseAuth.createUserWithEmailAndPassword(mailEntry,passwordEntry).addOnCompleteListener(new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {

    Log.d("task","success");    //tried calling sendEmailVerification here


}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {

    e.printStackTrace();     

}
});

}

创建新用户可以正常工作,但调用sendEmailVerification()无效,邮件无法发送。需要帮助。

  • 我使用的是最新版本的Firebase SDK
  • 我检查了垃圾邮件文件夹以确保邮件没有存储在那里

0 个答案:

没有答案