I increased the version of my WorkManager to 2.3.4 and there is new lint rule called SpecifyJobSchedulerIdRange
with description: "Warn when an app uses JobService
but does not specify jobIds for WorkManager." and explanation:
When using JobScheduler APIs directly, WorkManager requires that developers specify a range of JobScheduler ids that are safe for WorkManager to use so the
id
s do not collide. For more information look at androidx.work.Configuration.Builder.setJobSchedulerJobIdRange(int, int).
I specified the range of ids WorkManager can use by function setJobSchedulerJobIdRange as I should but I still get that lint warning. It's weird that a get that lint warning by my custom JobService and not by the Configuration.Builder.
In my Application class:
override fun getWorkManagerConfiguration(): Configuration {
return Configuration.Builder()
.setWorkerFactory(workerFactory)
.setJobSchedulerJobIdRange(100000, 101000)
.build()
}
@SuppressLint("SpecifyJobSchedulerIdRange")
on the sevice class – Leticia