Is it possible to store somewhere in the phone a file (or a setting) that will survive the app uninstall and that will be visible by all users of the phone?
Asked
Active
Viewed 67 times
0
-
1Historically on Android would be to use [`Environment.getExternalStorageDirectory()`](https://stackoverflow.com/q/9726990/295004) but [Environment.getExternalStorageDirectory() deprecated in API level 29 java](https://stackoverflow.com/a/57116787/295004) has a short term solution, but otherwise follow: https://developer.android.com/training/data-storage/use-cases#handle-non-media-files – Morrison Chang Nov 17 '20 at 23:19
-
Also if you are trying to wrap your head around storage on Android, see Commonsware's posts on the subject: https://commonsware.com/blog/2019/10/06/storage-situation-internal-storage.html https://commonsware.com/blog/2019/10/08/storage-situation-external-storage.html https://commonsware.com/blog/2019/10/11/storage-situation-removable-storage.html – Morrison Chang Nov 17 '20 at 23:25
1 Answers
0
For Android 10 devices request legacy external storage in manifest and you can write to external storage directory as usual. The Files app will show your file to all users after uninstall.
For Android 11 devices you can write a file in for instance public directory Documents. The Files app will show your file to all users. Also after uninstall.

blackapps
- 8,011
- 2
- 11
- 25