1 year ago

#375171

test-img

alpharoz

How to get the actual state of JobInfo?

Similar to WorkInfo, https://developer.android.com/reference/androidx/work/WorkInfo.State, how can we determine the actual state of JobInfo?

My use case: I have 2 jobs - Job 1 runs periodically on the charger, Job 2 runs for other various conditions (not periodic or on the charger). Both jobs update the same database. I'd like to ensure Job 1 is not actually running when Job 2 runs.

From the docs, it looks like I can use getPendingJob, but that will only tell me if the job is scheduled, and I'd like to have a better idea of what the job is doing at that given moment.

android

kotlin

android-workmanager

android-jobscheduler

0 Answers

Your Answer

Accepted video resources