我正在使用Firebase创建一个简单的聊天应用程序。但它没有添加具有signinwithEmailandPassword功能的新用户。我的代码就像这样
createBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String dname = displayName.getText().toString();
String email_str = email.getText().toString();
String pwd = password.getText().toString();
register_user(dname,email_str,pwd);
}
});
private void register_user(String dname, String email, String password){
mAuth.createUserWithEmailAndPassword(email, password)
.addOnCompleteListener(RegisterActivity.this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
Toast.makeText(RegisterActivity.this,"Inside function",Toast.LENGTH_SHORT).show();
if (task.isSuccessful()) {
Intent mainIntent = new Intent(RegisterActivity.this, MainActivity.class);
startActivity(mainIntent);
finish();
}
else{
Toast.makeText(RegisterActivity.this, "Authentication Failed",Toast.LENGTH_SHORT).show();
}
}
});
}