Android: Save file permanently (even after clear data / uninstall)
You shouldn't do that, you shouldn't force the users to keep data on their phones without their consent.
Anyway, application data directory will be deleted after uninstall, but NOT after an update
The only way to have persistent data is to use the SD card, but again, users won't like to have the data on their card after the app is uninstalled
Or you can consider:
- Storing the data on a remote server with some kind of authentication to retrieve it
- Using Data Backup service
Android, Saving data that won't be deleted even after I uninstall the app
You can save data to external storage, and encrypt it using a key only your app knows. Keep in mind this would not be entirely safe, as a malicious app could get the key from your apk beforehand and use it to decrypt the data.
Data save for an android app after it uninstall or force data clear from settings
Variation of 4.
using Google's backup servers, however the user can delete the data through his system settings.
How to store data that remains after uninstall
The databases made by your app will be stored in /data/data/your.package.name/databases/
and will be deleted on uninstallation of the app.
So, that's not a solution. I think the only way would be using the SD-card.
Is it possible to persisit a file after app uninstall with Android 11?
If the file already exists and not trying to create the file at the time of being uninstalled your options are limited and not really good.
There is no way to keep a file around without user interaction. Your only option is really to use the Storage Access Framework to save the file. What happens here is you have to have the user pick where they want to save the file via file picker intent. Get the uri path in onActivityResult
and use that to save the file.
Aside from requiring user intervention this also puts your file that has the licensing information in a publicly accessible location where anyone can get it which might not be something you want
That's really your only option if you want to keep a file around after your app has been uninstalled.
An Android app remembers its data after uninstall and reinstall
It's because Android 6 has automatic backup. You need to tune android:allowBackup
and android:fullBackupContent
in your manifest <application>
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.
More about AutoBackup on Android here.
Related Topics
How to Create an Android Activity and Service That Use Separate Processes
HTML5 <Video> Element on Android Does Not Play
How to Know the Calling Activity in Android
Android Ndk Std::To_String Support
Web App on Android Browser Width Issue
App Crash After Activity Has Been Killed in Background
How to Encode Bitmaps into a Video Using Mediacodec
How to Make Facebook's App New Menu on Android
How to Create Ripple Effect in Simple Layout
Download Images Using Android Webview
Fragment View in Viewpager Is Not Restored When Resuming
A Correct Way to Convert Byte[] in Java to Unsigned Char* in C++, and Vice Versa
Using Videoview for Streaming or Progressive-Download Video
Read Logs from All Apps on Android from Within an App for Android 4.2+
Android Browser Textarea Scrolls All Over The Place, Is Unusable