How to modify this onStart() method to get my separate Phone auth user database?
@Override
protected void onStart() {
super.onStart();
FirebaseAuth firebaseAuth = FirebaseAuth.getInstance();
if (firebaseAuth.getCurrentUser() != null) {
if(what condition required to check for phone auth){
startActivity(new Intent(EnterAs.this, UI_Main_User.class));
finish();
} else {
for email auth users
}
}
You can do that by calling UserInfo's getProviderData() method on the FirebaseUser object, to get the list of all authentication providers that are used by the authenticated user. One more thing to note is that each UserInfo class contains a method named getProviderId() which returns the ID of the provider.
A workable solution in code might look like this:
If in the future you'll use for example, Google authentication with Firebase, then you should check against: