0

I'm building an application and need to ensure my data is retained if the service gets destroyed. I've used preferences to save the user's settings, which works fine.

The data I now want to store are longitudinal and latitudinal values set when the application is first configured, which are being used as a base location and are vital they retain their value.

I'm assuming content providers are overkill for my needs.

*Anyone dealing with the problem caused by the change to fragmented preferences, this is worth a look.

Community
  • 1
  • 1

1 Answers1

0

In your activity onCreate()/onResume() load the sharedPref data. and inside onDestroy()/onPause() of your activity save the service data

Pradip
  • 3,189
  • 3
  • 22
  • 27