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!"
}
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.