Call showFirebaseLoginPrompt() if no user is logged in already
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?
Have you tried calling it in onStart()?
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
// ...
}