Skip to content
Advertisement

Using Firebase open a different activity if user logged in second time

I am using Firebase in my project. What I want?? When a new user logged in, he goes through all activities (like Information activity, etc) after login and then to the dashboard. when that user logout from the app and logged in again then directly go to dashboard not need to fill that all information again.

JavaScript

I am using this code, but it takes both new and old users to the dashboard.

Advertisement

Answer

Simply checking:

JavaScript

Doesn’t help you know if the user signs in for the first time, it only checks if the user is authenticated or not. To know is the user signs in for the first time, please use the following lines of code:

JavaScript

Edit:

According to your comment:

What does getAdditionalUserInfo() method do?

task.getResult() returns an object of type AuthResult. That being said, we can call the above method on such an object, to return an object of type AdditionalUserInfo. As you can see in the docs, there is a method there called isNewUser() that:

Returns whether the user is new or existing

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement