gpt4 book ai didi

java - Firebase - 电子邮件地址已被另一个帐户使用

转载 作者:太空宇宙 更新时间:2023-11-04 11:09:20 24 4
gpt4 key购买 nike

当我尝试使用 Fire Base 身份验证登录我的应用程序时,它显示电子邮件地址已被另一个帐户使用。我无法弄清楚问题所在。

public class LoginActivity extends AppCompatActivity {

private EditText login_email, login_password;
private Button login_button;
private FirebaseAuth firebaseAuth;

private ProgressDialog progressDialog;


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

login_button = (Button) findViewById(R.id.btnLogin);
login_email = (EditText) findViewById(R.id.login_email);
login_password = (EditText) findViewById(R.id.login_password);

firebaseAuth = FirebaseAuth.getInstance();
}


public void onClickLoginButton(View view) {

progressDialog = ProgressDialog.show(LoginActivity.this, " Please Wait...", "its processing", true);

firebaseAuth.createUserWithEmailAndPassword(login_email.getText().toString(), login_password.getText().toString())
.addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
progressDialog.dismiss();

if (task.isSuccessful()) {
Toast.makeText(LoginActivity.this, "Login Successfull...Bingo...", Toast.LENGTH_LONG).show();
Intent i = new Intent(LoginActivity.this, ProfileActivity.class);
i.putExtra("Email", firebaseAuth.getCurrentUser().getEmail());
startActivity(i);
} else {
Log.e("ERROR", task.getException().toString());
Toast.makeText(LoginActivity.this, task.getException().getMessage(), Toast.LENGTH_LONG).show();
}


}
});


}
}

最佳答案

firebaseAuth.createUserWithEmailAndPassword(email,password) 这用于创建新用户..

要登录现有用户,您可以使用firebaseAuth.signInWithEmailAndPassword(email,password)

有关更多信息,请关注此 Firebase 文档:https://firebase.google.com/docs/auth/android/password-auth#sign_in_a_user_with_an_email_address_and_password

关于java - Firebase - 电子邮件地址已被另一个帐户使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46196898/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com