Android预定工作能否在应用升级后继续存在?

时间:2017-03-23 17:46:20

标签: java android scheduled-tasks upgrade delayed-job

我想知道使用JobScheduler Framework安排的Jobs是否能够在应用升级后继续存在?我有一个注册的BroadcastReceiver正在听

MY_PACKAGE_REPLACED

意图。在这种情况下,我是否需要重新安排工作?

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

上面的链接会导致类似的问题,但没有答案,所以请不要将此标记为重复。

2 个答案:

答案 0 :(得分:1)

您可以将BroadcastReceiver与意图过滤器操作sudo xmlstarlet ed -L \ -s '//configuration' -t elem -n "property" -v '' \ -s '//configuration/property[last()]' -t elem -n "name" -v "test-1" \ -s '//configuration/property[last()]' -t elem -n "value" -v "00001" \ -s '//configuration' -t elem -n "property" -v '' \ -s '//configuration/property[last()]' -t elem -n "name" -v "test-2" \ -s '//configuration/property[last()]' -t elem -n "value" -v "00002" \ /etc/path/to/file.xml BOOT_COMPLETED一起使用,然后从那里安排您的工作。或者将该事件转发给服务......任何事情。

答案 1 :(得分:1)

  

我想知道使用JobScheduler Framework计划的Job是否能够在应用升级后继续使用?

目前不是。正如您所看到的in the issues of Firebase Job dispatcher(内部使用相同的API),打开了一个问题" GooglePlayDriver:在应用更新后不会重新安排作业"。