I have a remote service in android. It’s binded to my list activity and sends some messages to it. The service contins scheduled task in it. I also have preference: refresh interval for my service. All I want is to restart the service when user changes refresh interval. Butif I do it in onSharedPreferenceChanged() then I loose the connection from my list activity. How can I solve it? Thanks.
I know that I can use Broadcast Reciever. Is there another way?
Why? Why not a local service?
Why? Why not use
AlarmManager, so your service isn’t just sitting around in RAM, watching time pass?Why? Why not just change your
AlarmManagerschedule? If you use a local service, your service can use aSharedPreferencesandsetOnSharedPreferenceChangeListener()to be automatically notified of changes in the refresh interval.