Do android scheduled jobs survive an app upgrade?

2019-07-04 05:30发布

问题:

I would like to know whether Jobs scheduled using the JobScheduler Framework survive an app upgrade? I have a registered BroadcastReceiver listening to the

MY_PACKAGE_REPLACED

intent. Do i need to reschedule a job in this case?

Does Android JobScheduler or GCM JobScheduler persist jobs after an app update?

The link above leads to a similar question but does not have an answer so kindly do not mark this as a duplicate.

回答1:

I would like to know whether Jobs scheduled using the JobScheduler Framework survive an app upgrade?

Currently it is not. As you can see in the issues of Firebase Job dispatcher (which internally uses same API), there is a issue opened "GooglePlayDriver: doesn't reschedule Jobs after App is updated".



回答2:

You could use a BroadcastReceiver with intent-filter actions BOOT_COMPLETED and MY_PACKAGE_REPLACE and then schedule your job from there. Or relay that event to a service...anything.