Android JobScheduler onStartJob called multiple times

ε祈祈猫儿з 提交于 2019-12-05 00:55:53

I guess it's caused by the pending Job, so I call mJobScheduler.cancelAll() after the service started, problem resolved.

drmrbrewer

I think this relates to the Android bug reported here, which has apparently been fixed for Android N but will be present in earlier versions.

The OP is using a setOverrideDeadline(). My understanding of the issue reported in the linked post above is that if the job is running when the override deadline fires, it causes the job to be scheduled to run again.

So the advice is to ensure that the override fires either before the job is scheduled (not sure how that is achieved) or after it has finished. Neither seems particularly satisfactory, but at least it seems to have been fixed in Android N.

Imran Khan Saifi

this is the problem in android lollypop and Marshmallow. It is fixed in Nougat as explained by Matthew Williams here

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!