简体   繁体   中英

Make application edit settings when application is not active. Android

I have an application that prompts the user to input a time value via timePicker. I wrote the input into file using BufferedWriter.

I want my application to edit a user setting every day at the provided time. I'm able to edit the setting using a function call in the app, but I do not know how to run this function when the application is not active.

How can I have the application run this function every day at the specified time even when the application is not active?

Use AlarmManager to schedule a Service or BroadcastReceiver (or even an Activity if you need user interaction) at the specified time. Then simply put the code for editing your settings in the Service or BroadcastReceiver.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM