如何在后台检查 SQLite table 的值,并每小时发送一次通知?
How do I check a value of an SQLite table in the background, and send a notification every hour?
我一直在尝试找出如何做到这一点,也许是使用 IntentService,但我不确定这是我想做的事情的正确方法。
至少有人能给我指出正确的方法吗?
要在后台执行操作,您可以使用 Service, AsyncTask 或简单的线程。
要循环工作,您可以使用 Timer, AlarmManager and ScheduledExecutorService, while the most common one will be Handler。
以上每一种都有自己的优点和缺点。详细了解它们以找到您需要的内容。
我一直在尝试找出如何做到这一点,也许是使用 IntentService,但我不确定这是我想做的事情的正确方法。 至少有人能给我指出正确的方法吗?
要在后台执行操作,您可以使用 Service, AsyncTask 或简单的线程。
要循环工作,您可以使用 Timer, AlarmManager and ScheduledExecutorService, while the most common one will be Handler。
以上每一种都有自己的优点和缺点。详细了解它们以找到您需要的内容。