3

I am developing an application and I need to store some data in a file in internal storage. The issue is that I need to be able to read the data even when the application is uninstalled. I have read many different solution but none worked for me. I would appreciate if anyone gives me a hint on how to proceed. The idea is that I store some data on a file in internal storage and even if the user uninstalls the application next time he opens the app, the app should be able to read the content from the file. I tried many solution but all seem to delete the file when the app is uninstalled.

Kind regards

Boris
  • 213
  • 4
  • 13
  • you should try storing it on sdcard if you want to use data after reinstall. – Uniruddh Jul 06 '16 at 07:55
  • The issue is that the application targets a wide range of phones and some phones might not have SD card. I need to be able to store it on internal storage. regards – Boris Jul 06 '16 at 07:57
  • @Boris every phone has External Storage even if there is sdcard or not – Muthu Jul 06 '16 at 08:38

2 Answers2

1

Seems like SO has a lot of similar questions. E.g. see Android: Save file permanently (even after clear data / uninstall). Bytheway, if you consider to keep data somehow - you may try to find some path on internal storage that has RW permissions for all users. Try /data/local/tmp directory for example. But anyway you should be aware that this is very fragile approach and IMO just a bad practice.

Community
  • 1
  • 1
Sergio
  • 8,099
  • 2
  • 26
  • 52
1

This is possible by using the external storage. However, you cannot prevent users from manually removing such files using File Browsers. So insert some (null)checks while trying to read your data.

Baschi
  • 1,128
  • 11
  • 14