开发者

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

开发者 https://www.devze.com 2022-12-18 23:18 出处:网络
After upgrading my applicati开发者_C百科on 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 register for in the

After upgrading my applicati开发者_C百科on 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 register for in the manifest.


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

精彩评论

暂无评论...
验证码 换一张
取 消