Is there a way to restart a service after upgrading the application on Android?

前端 未结 1 1614
情话喂你
情话喂你 2021-02-06 01:48

After upgrading my application I would like the service to restart if it was running before. Is there any way to do this? I didn\'t see any Broadcast Intents that I could regi

1条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-06 02:21

    You are right that you should be using a BroadcastReceiver.

    Have a look at this question about restarting Alarms on upgrade; it shows how you can use the ACTION_PACKAGE_REPLACED Intent to see when an application is upgraded.

    0 讨论(0)
提交回复
热议问题