本文介绍了有没有办法升级Android上的应用程序后,重新启动服务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
升级我的应用程序后,我想,如果在此之前运行重新启动该服务。有没有办法做到这一点?我没有看到任何广播意图,我可以登记在清单中。
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 register for in the manifest.
推荐答案
您说的没错,你应该使用的BroadcastReceiver
。
You are right that you should be using a BroadcastReceiver
.
看一看this问题有关重新启动对升级报警;它展示了如何使用<$c$c>ACTION_PACKAGE_REPLACED$c$c>意图看,当一个应用程序的升级。
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.
这篇关于有没有办法升级Android上的应用程序后,重新启动服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!