'In Android Studio, how to check if user logged in anonymously or with email, or google sign in?
I have an app. On startup, it is logging in anonymously, automatically. Then you can sign in for real if you want. There is a button, that i want to make useable only for "real logged-in" users. I tried this code but this is true for anonymously signed-in users too:
user = FirebaseAuth.getInstance().getCurrentUser();
if(user != null){
//can use button
}else{
// "please sign in!"
}
Solution 1:[1]
You can see whether the user is anonymously logged in by checking its isAnonymous() method.
If you want to check for specific non-anonymous providers, you can check the providerId in the providerData as shown here: Detect Firebase Auth Provider for Loged in User
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Frank van Puffelen |
