如何获得JobInfo的实际状态?
类似于workInfo, https://developer.android.com/reference.com/reference.com/reference/androidx/- work/workinfo.state ,我们如何确定JobInfo的实际状态?
我的用例:我有2个工作 - 工作1在充电器上定期运行,工作2在其他各种条件(不是周期性或充电器上)运行。这两个作业都更新了相同的数据库。我想确保工作1在运行2时实际运行。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论