How to reschedule Alarm Manager on Preference Change
Posted
by Priyank
on Stack Overflow
See other posts from Stack Overflow
or by Priyank
Published on 2010-05-25T16:45:11Z
Indexed on
2010/05/25
16:51 UTC
Read the original article
Hit count: 348
Hi,
I have an Android Service. When a phone boots up, a broadcast receiver receives a notification and it schedules the service to run repeatedly at a gap of X minutes. Henceforth After every X minutes another broadcast receiver gets those notifications and kicks the service off, which does it's job and quits. So far so good.
Now I want those X minutes to be configurable. I have a perf.xml similar to what is given at the link below. This XML captures all my preferences along with that of service timer. http://android-journey.blogspot.com/2010/01/for-almost-any-application-we-need-to.html
Now when user changes preferences; how can I reschedule the alarm? Is there a way I can set a listener on preferences change? I have used only XML files to speficy preferences screen.
Any ideas will be welcome.
Cheers
© Stack Overflow or respective owner