Issue
I am working on an application where I have created a user login system with a phone number. When the user login to the first time the User will go to Phone Activity then OTP Activity and then Setup Profile Activity to edit the name and other details and then to the Home Activity. So I want that when the already registered user login again. Then that user should skip the profile setup activity, User should move to the Home Activity directly after the OTP activity. I am using the firebase phone method to log in. How can I achieve that?
Solution
The best option that you have is to store a boolean value called profileCompleted
in Firestore or in the Realtime Database. Each time the user opens the app, you have to check against this value and take action accordingly. In Firestore, this field can be added inside the user object like this:
Firestore-root
|
--- users (collection)
|
--- $uid (document)
|
--- profileCompleted: true
|
--- //other fields
Local storage like SharedPreferences isn't a recommended option in this case, because it doesn't persist across application uninstalls.
Answered By - Alex Mamo
Answer Checked By - Candace Johnson (JavaFixing Volunteer)