【发布时间】:2018-12-24 16:09:40
【问题描述】:
我在我的 Android 应用中实现了 Firebase 提供的电子邮件/密码登录方法。它工作正常。但是今天由于某些我不知道的原因它没有工作。我没有更改任何与我的登录活动相关的代码,也没有更改我的 Firebase 控制台中的设置。
private void signIn(String email, String password) {
Log.d(TAG, "signIn:" + email);
if (!validateForm()) {
return;
}
showProgressDialog();
// [START sign_in_with_email]
firebaseAuth.signInWithEmailAndPassword(email, password)
.addOnCompleteListener(this, task -> {
if (task.isSuccessful()) {
// Sign in success, update UI with the signed-in user's information
Log.d(TAG, "signInWithEmail:success");
FirebaseUser user = firebaseAuth.getCurrentUser();
updateUI(user);
} else {
// If sign in fails, display a message to the user.
Log.w(TAG, "signInWithEmail:failure", task.getException());
Toast.makeText(LoginActivity.this, "Authentication failed.",
Toast.LENGTH_SHORT).show();
}
hideProgressDialog();
});
// [END sign_in_with_email]
}
在 Logcat 中,它显示程序确实到达了登录方法,但不知何故,身份验证过程从未完成(日志从未显示 signInWithEmail:success 或 signInWithEmail:failure)。
我确实尝试了其他解决方案,例如将 addOnCompleteListener 更改为 addOnSuccessListener 但没有任何改变。 Firebase 服务目前无法正常工作吗?还是我的代码有问题?我完全迷路了。感谢您分享任何想法。
【问题讨论】:
-
“Firebase 服务当前无法运行吗?”要找到我们的,请查看status.firebase.google.com。但目前没有已知的中断。
-
@FrankvanPuffelen 谢谢。那时服务工作正常。我想我现在应该尝试重新安装我的 Android SDK
标签: android firebase firebase-authentication