Reputation: 451
I am trying to get the login state of the user in Flutter, whenever I run my application for the first time (Only when I uninstall and reinstall the app) following code return a user.
I already tried to get the user from whenComplete
and then
both return
the same.
FirebaseAuth _firebaseAuth = FirebaseAuth.instance;
FirebaseUser user = await _firebaseAuth.currentUser();
return user;
returned user is a platform user from my android device, and if I reload my app after install user will be removed.
Edit:
Funny thing is minimizing the app removes the unknown user.
Upvotes: 6
Views: 2494
Reputation: 17756
That happens because data will persist anyways offline in some cases regardless of the app being deleted or not, and thus, your previous Firebase user.
Referring to this answer:
It's because Android 6 has automatic backup. You need to tune android:allowBackup and android:fullBackupContent in your manifest tag if you don't want your data backed up or if you want to include or exclude some resources. It's not a bug.
So basically, add android:allowBackup="false"
and android:fullBackupContent="false"
in manifest.xml and you should be fine.
Upvotes: 4