mAuth.signInAnonymously()
.addOnCompleteListener(activity, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()) {
// Sign in success, update UI with the signed-in user's information
LogUtils.setLog(TAG, "Authentication success");
FirebaseUser user = mAuth.getCurrentUser();
} else {
// If sign in fails, display a message to the user.
LogUtils.setLog(TAG, "Authentication failed");
}
}
});
로그인에 성공하면 getCurrentUser 메서드로 사용자의 계정 정보를 가져올 수 있습니다.