最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

android - How many times I can reschedule workers with WorkManager is there a quota for this - Stack Overflow

programmeradmin3浏览0评论

I'm using WorkManager to show to users some notifications in case of their long inactivity in the app. So basically I detect if user left the app(app went to background or destroyed) in this case I'm scheduling certain chain of workers which would show notifications. When user goes foreground I'm canceling these workers. It happens many times, so I'm wondering are there any restrictions, quotas of how many times I can reschedule.

To schedule I'm using these approach

workManager.beginUniqueWork(
            TAG_SOME_WORK,
            ExistingWorkPolicy.REPLACE,
            workRequests[0]
        ).then(workRequests.subList(1, workRequests.size))
            .enqueue()

To cancel:

WorkManager.getInstance(context).cancelUniqueWork(TAG_SOME_WORK)

I'm using WorkManager to show to users some notifications in case of their long inactivity in the app. So basically I detect if user left the app(app went to background or destroyed) in this case I'm scheduling certain chain of workers which would show notifications. When user goes foreground I'm canceling these workers. It happens many times, so I'm wondering are there any restrictions, quotas of how many times I can reschedule.

To schedule I'm using these approach

workManager.beginUniqueWork(
            TAG_SOME_WORK,
            ExistingWorkPolicy.REPLACE,
            workRequests[0]
        ).then(workRequests.subList(1, workRequests.size))
            .enqueue()

To cancel:

WorkManager.getInstance(context).cancelUniqueWork(TAG_SOME_WORK)
Share Improve this question asked Mar 10 at 17:10 Jenya KirmizaJenya Kirmiza 7332 gold badges10 silver badges28 bronze badges 1
  • 1 There is no limit – tyczj Commented Mar 10 at 17:13
Add a comment  | 

1 Answer 1

Reset to default 2

There are no limits or quotas, but it would be practical to consider battery optimisation and system health

发布评论

评论列表(0)

  1. 暂无评论