Search code examples
androidandroid-studioandroid-internal-storage

Does data saved to internal storage persist over sequential runs in Android Studio?


I have an application that saves data onStop() to a file in the internal storage. And then when the application is started again it will attempt to retrieve that data that was stored there onStart().

I am currently testing my application through running the application through Android Studio onto my Google Pixel 2 (Android 8.1.0 API 27).

My question has three parts. Don't feel obligated to answer all parts.

  1. Since I am emulating the app on my device, are the internal storage files deleted when I close the app on my device? Or do they persist?
  2. Is this the same with SQLite and Shared Preferences? Or do they persist through emulation runs?
  3. If they are deleted what are the steps I should take in-order to test that my data management process is working? Should I place the apk on my device and then run/close it?

P.S. I am a university student learning Android development, I have been scouring stack-overflow and Android documentation for information on data storing and the like. Its entirely likely that I missed something so if you know of some resource that might help me out here, I would greatly appreciate you sending it my way.


Solution

  • Have you tried?

    Short answer is SQLite data and Shared Preferences will stick around unless you programmatically remove it, uninstall the app OR clear data from settings.