FirebaseAuth.AuthStateListener mAuthListener;
private FirebaseAuth mAuth;
EditText name, email, password;
Button submit;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.signup);
mAuth = FirebaseAuth.getInstance();
mAuthListener = new FirebaseAuth.AuthStateListener() {
@Override
public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
FirebaseUser user = firebaseAuth.getCurrentUser();
if (user != null) {
// User is signed in
Log.d("########", "onAuthStateChanged:signed_in:" + user.getUid());
}
else{
// User is signed out
Log.d("########", "onAuthStateChanged:signed_out");
}
}
};
name = (EditText) findViewById(R.id.input_name);
email = (EditText) findViewById(R.id.input_email);
password = (EditText) findViewById(R.id.input_password);
submit = (Button) findViewById(R.id.btn_signup);
submit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mAuth.createUserWithEmailAndPassword(email.getText().toString(), password.getText().toString()).addOnCompleteListener(SignUp.this, new OnCompleteListener < AuthResult > () {
@Override
public void onComplete(@NonNull Task < AuthResult > task) {
Log.d("###########", "signInWithEmail:onComplete:" + task.isSuccessful());
}
});
Task.isSuccessful()
始终返回false,我无法添加任何用户。
我在Firebase上启用了电子邮件身份验证,并且能够从伪造本身添加用户,我无法进行调试并找出问题所在。
已完成所有其他设置,例如添加依赖项并将从Firebase获取的配置文件复制到app目录中。请帮忙。