에서 중포 기지와 비밀번호를 잊어 버렸, 난 그냥이 발견 로그인하지 않았으므로 어떻게 알아낼 수 있습니까?이 문서를 보면 로그인 활동
1
A
답변
2
FirebaseAuth.getInstance()
메서드는 null
을 반환하지 않으므로 코드가 작동합니다. onCreate()
방법 FirebaseAuth
private FirebaseAuth mAuth;
의 인스턴스를 선언
:.
그것은 Android Firebase Authentication getting started documentation부터
FirebaseAuth.getInstance().getCurrentUser()
사용자가 로그인하지 않은 경우null
를 반환 방법의
, FirebaseAuth 인스턴스를 초기화하십시오. . 활동을 초기화 할 때mAuth = FirebaseAuth.getInstance();
은 사용자가 현재 로그인 있는지
@Override public void onStart() { super.onStart(); // Check if user is signed in (non-null) and update UI accordingly. FirebaseUser currentUser = mAuth.getCurrentUser(); updateUI(currentUser); }
을 확인하고 귀하의 질문에 당신이 가지고있는 코드는 send a password reset section에서입니다 :
sendPasswordResetEmail
방법을 사용하여 비밀번호 재설정 이메일을 사용자에게 보낼 수 있습니다. 예를 들면 다음과 같습니다. 사용자가 로그인되어 있지 않기 때문에FirebaseAuth auth = FirebaseAuth.getInstance(); String emailAddress = "[email protected]"; auth.sendPasswordResetEmail(emailAddress) .addOnCompleteListener(new OnCompleteListener<Void>() { @Override public void onComplete(@NonNull Task<Void> task) { if (task.isSuccessful()) { Log.d(TAG, "Email sent."); } } });
emailAddress
변수가 여기에 지정된