firebaseを使用して新しいアカウントにサインアップしようとすると、アカウントは正常に作成されますが、OnCompleteListenerはOnFailureListenerでさえ決して起動しません。Firebase createUserWithEmailAndPasswordは成功しましたが、完了していません
アカウントをサインインしようとすると、システムはまず、アカウントが存在するかどうか、ログインしようとした場合、新しいアカウントが作成されないかどうかをチェックしますアカウント。私がcreateUserWithEmailAndPasswordを使用すると、新しいアカウントが作成されますが、アプリケーションはすぐに閉じられ、 "OnCompleteListener"または "OnFailureListener"のコードは決して実行されません。
これらのコードの前とlogcatのこれらのコードの後にログが表示されますが、これらのコードのログはlogcatに記録されません。
auth.signInWithEmailAndPassword(mEmail, mPassword)
.addOnCompleteListener(LoginActivity.this, new OnCompleteListener<AuthResult>()
{
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
Log.w(TAG, "signInWithEmail:onComplete:" + task.isSuccessful());
// If sign in fails, display a message to the user. If sign in succeeds
// the auth state listener will be notified and logic to handle the
// signed in user can be handled in the listener.
if (!task.isSuccessful()) {
auth.createUserWithEmailAndPassword(mEmail, mPassword)
.addOnCompleteListener(LoginActivity.this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
Log.d(TAG, "Start Testing"+task.getException());
// If sign in fails, display a message to the user. If sign in succeeds
// the auth state listener will be notified and logic to handle the
// signed in user can be handled in the listener.
if (!task.isSuccessful()) {
Log.d(TAG, "Testing Not Success" + task.getException());
task.getException();
Log.d(TAG, "Testing Not Success 2" + task.isSuccessful());
}else{
Log.d(TAG, "Testing is Success" + task.isSuccessful());
// startActivity(new Intent(LoginActivity.this, MainMenuActivity.class));
// finish();
}
// ...
}
});
}else{
Log.w(TAG, "signInCompleted");
Toast.makeText(LoginActivity.this, "HI bitch",
Toast.LENGTH_SHORT).show();
LoginActivity.this.startActivity(new Intent(LoginActivity.this, MainMenuActivity.class));
//finish();
}
// ...
}
})
.addOnFailureListener(LoginActivity.this, new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Log.d(TAG, "Start Testing"+e);
}
});
解決策を見つけたら、ポストを更新してください。 – Talha