【发布时间】:2019-09-14 06:11:36
【问题描述】:
SnapShot 无法解析方法 'addOnCompletionListener(com.myAppliction.signup, 匿名 com.google.android.gms.tasks.OnCompletionListener)
我正在尝试在 firebase 中添加用户,但此错误不断出现。
Map<String, Object> user = new HashMap<>();
user.put("Username", username);
user.put("Password", password);
user.put("email", email);
db.collection("users").add(user).addOnCompleteListener(signup.this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
Log.d("signUpSuccessful", "createUserWithEmail:onComplete:" + task.isSuccessful());
if (!task.isSuccessful()) {
FirebaseAuthException e = (FirebaseAuthException )task.getException();
Toast.makeText(signup.this, "Failed Registration: "+e.getMessage(), Toast.LENGTH_SHORT).show();
return;
}
// ...
}
});
【问题讨论】:
标签: java android firebase firebase-authentication