How to transfer alarm manager to change preferences

I have an Android service. When the phone boots up, the broadcast receiver receives a notification, and it plans to restart the service at once in X minutes. From now on, every X minutes, another broadcast receiver receives these notifications and disables the service, which does the job and shuts down. So far so good.

Now I want these X minutes to be configured. I have perf.xml similar to what is given in the link below. This XML captures all my preferences, as well as a maintenance timer. http://android-journey.blogspot.com/2010/01/for-almost-any-application-we-need-to.html

Now when the user changes the settings; How can I bear the alarm? Is there a way that you can configure the listener to change the settings? I used only XML files for the speficy settings screen.

Any ideas would be welcome.

Greetings

+3
source share
1 answer

There is an OnPreferenceChangeListener, just install it and implement it. As I recall, you have configured this preference. Therefore, you need to get this preference findPreference ("myAlarmInterval"); and then install the listener

, . , , - - / .

, .

+6

Source: https://habr.com/ru/post/1747055/


All Articles