I have an Android app where users are registered in the app with their phone number, I am using Firebase to store in Authentication their phone and their email and also I am saving in the Realtime Database their phone, their full name, and their email. The structure in the Realtime Database is as follows:
Auto-Generated ID
+16505553434: "some@email.com"
email:"some@email.com"
first name: "First name"
last name: "Last name"
phone: "+16505553434"
After the user has registered and signed out when they try to use the app again I want to: if the user exists I don't want to do phone authentication again this should happen only once when they register if the user exists in the database I want to just type their password and log in. But the problem is how will I check if the user is phone registered in Firebase.
If the user has registered I want to show a layout for the input password while if the user is not registered I want to show the OtpView
so that the user to do phone authentication-registration.
When the user has signed out the FirebaseAuth.getInstance().getCurrentUser() is null so i cannot use that.
What can I do to check if the user is registered or not?