开发者

Updating foreground service everyday at an exact time

I've written an application with a foreground service. The service notification must be updated precisely at 6 pm every day.

I've tried to achieve this functionality with AlarmManager but most of the time it is not working. Would WorkManager solve this problem (if it is, please explain how I should use it in this case) 开发者_运维知识库or is there a way to do this?


WorkManager is the sure bet for your use case. According to the documentation:

WorkManager is the recommended solution for persistent work. Work is persistent when it remains scheduled through app restarts and system reboots.

More specifically, you would need to schedule a Deferrable work, which is a task that starts at a later time and can run periodically.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜