Reputation: 2075
I'd like to make my IntentService
remember when it was called last time and how many times it was called so far. It doesn't matter if these values are reset when the phone is rebooted, but they must not be reset when the application process is killed.
Should I store these state variables in a SharedPreferences
, or is there is a better and/or more lightweight way? I tried intent.getExtras()
, but it seems that the values I put there are not remembered between calls.
Upvotes: 0
Views: 699
Reputation: 7120
For persistent storage like this, SharedPreferences
is usually the way to go. And don't forget to do commit()
after editing the preference.
Upvotes: 3