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.
Asked
Active
Viewed 255 times
0
-
1I 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
-
1Unfortunately 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
-
1SharedPreferences saves to a file so that is not keeping it in RAM. – DeeV Aug 12 '16 at 13:27