问题
I found the Firebase anonymous authentication very interesting and I'm willing to implement it in my Android app. I read that authentication does not survive app uninstalls but does it survive when the user intentionally clears the app cache?
Setting - Apps - MyApp - App Info - Storage - CLEAR DATA
I really need to know that before actually implementing it. Thanks!
回答1:
No, it will not survive. No data previously saved by the app will survive. The whole point of clearing app data is to make the app behave as if it was newly installed.
回答2:
Anonymous auth is not intended to be a permanent user id. If your use case is for it to last as long as the app does, you should provide the option to upgrade to a permanent account or find an alternative authentication method, such as signing your own tokens, or using phone number or email auth.
To directly answer the question, Anonymous Authentication only survives as long as the token on Android, and the token is stored in local cache and will be cleared when you clear the app data.
In web, token is stored in indexedDB. We fallback to localStorage if indexedDB is not available. For Android, we use SharedPreferences. For iOS, we use the keychain. So this is untrue in iOS, where the keychain will survive app reinstalls.
来源:https://stackoverflow.com/questions/54441341/does-firebase-anonymous-authentication-survive-when-clearing-app-cache