FirebaseUI-Android icon indicating copy to clipboard operation
FirebaseUI-Android copied to clipboard

Call showFirebaseLoginPrompt() if no user is logged in already

Open abhilash1in opened this issue 10 years ago • 2 comments

I want my app to display the login prompt when the user opens the app and if there is no currently logged in user. I do not want to call it on click of any button. I'm getting a Null pointer exception if i place showFirebaseLoginPrompt() directly in onCreate and the log cat reads: Attempt to invoke virtual method FirebaseLoginDialog.show on a null object reference

Where should I call showFirebaseLoginPrompt() to show login dialog, only if there is no currently logged in user, without the user having to click any button?

abhilash1in avatar Apr 29 '16 16:04 abhilash1in

Have you tried calling it in onStart()?

JStav avatar May 02 '16 16:05 JStav

While the exact method showFirebaseLoginPrompt is not applicable to 0.4.0, this is now 'fixed' because you can do this in onStart():

if (FirebaseAuth.getInstance().getCurrentUser() == null) {
    // Not signed in, show login UI
    // ...
} else {
    // Signed in, continue
    // ...
}

samtstern avatar May 24 '16 17:05 samtstern