How to keep the App always logged in with Firebase

Asked

Viewed 481 times

0

How to get my App to log in after waxing?

Ex: I logged in once and every time I start the application again it already starts logged in.

1 answer

0


According to the documentation Manage users in Firebase, the recommended way to identify the connected user is to call the method getCurrentUser(). If no user is logged in, getCurrentUser() returns a null value.

Example:

FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
if (user != null) {
    // Usuário está logado
} else {
    // usuário não está logado
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.