When a user deletes and reinstalls my app, I want their anonymous user account to persist. My iOS app is working as expected, but Android is not. I create anonymous users like so
if (auth.getCurrentUser() == null) {
auth.signInAnonymously().addOnCompleteListener(task -> {});
}
When I delete the app and reinstall, auth.getCurrentUser()
is null and I have to re-authenticate.
My AndroidManifest.xml contains android:allowBackup="true"
It is null becase Firebase Anonymous Authentication
accounts does not persist across application uninstalls. If you uninstall the application, everything that was saved locally will be deleted, including the anonymous auth token that identifies that account. There is no way to reclaim that token for the user. You can use Firebase Anonymous Authentication
to create and use temporary accounts
to authenticate users in your application.
These temporary anonymous accounts can be used to allow users who haven't yet signed up to your app. If such an anonymous user decides later to sign up to your application, you can link their sign-in credentials to the anonymous account. What should you do, you should encourage your users to fully log in with a supported account provider so that they can log in from all their devices without worry of losing their data.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With