0

I need to preserve some data and clear it when the device is turned off. It can't be persisted in any ways. It should only be in RAM.

YacSrk
  • 1,555
  • 1
  • 11
  • 9
  • 1
    I think this can help you: http://stackoverflow.com/a/14133824/5109911 – Marco Santarossa Aug 11 '16 at 17:42
  • You can use a Broadcast Receiver with `SharedPreferences`. – Machado Aug 11 '16 at 17:57
  • 1
    Unfortunately an application's memory can be wiped from the device whenever Android feels the need to clean up resources for other apps. Possibly the only way to do it is to keep a reference to the data in a Service, then re-download or re-create the data when the Service is eventually restored. – DeeV Aug 12 '16 at 13:26
  • 1
    SharedPreferences saves to a file so that is not keeping it in RAM. – DeeV Aug 12 '16 at 13:27

0 Answers0