The warning suggests, that as long as an implementation of JobService
class is created then user should be specifying which IDs the WorkManager
is eligible to use "in order to not clash job codes used in the rest of your app" (see dosc at setJobSchedulerJobIdRange(int, int)
).
This should be done upon creation of androidx.work.Configuration
instance:
Configuration.Builder builder = new Configuration.Builder();
builder.setJobSchedulerJobIdRange(0, 1000);
...
Unfortunately, I couldn't make the thing work for my setup and I had to look into the sources of lint (SpecifyJobSchedulerIdRangeIssueDetector
). As I can understand from the logic, as soon as there is a
method call to setJobSchedulerJobIdRange
(see line 92) - then the detector will assume that job range id has been specified by the user, but that doesn't work (at least on my machine).
Unfortunately, checking the test class for the detector didn't convey anything either.
As for now I can claim that:
- creating a kotlin class that extends
JobService
doesn't result in a lint warning
- creating a java class that extends
JobService
results in a lint warning, but that doesn't get fixed even when setJobSchedulerJobIdRange()
is performed in some other class other than the JobService
Interestingly, calling setJobSchedulerJobIdRange()
in the JobService
class fixes the warning:

Apparently, there are some issues with this detector implementation (or on my machine).
Nevertheless, if you've specified the range of IDs that WorkManager is free to use (i.e. you have called setJobSchedulerJobIdRange()
) - then you're good to suppress this warning.