有没有办法升级Android上的应用程序后,重新启动服务?没有办法、重新启动、应用程序、Android

由网友(男生站直别趴下。)分享简介:升级我的应用程序后,我想,如果在此之前运行重新启动该服务。有没有办法做到这一点?我没有看到任何广播意图,我可以登记在清单中。After upgrading my application I would like the service to restart if it was running before. Is...

升级我的应用程序后,我想,如果在此之前运行重新启动该服务。有没有办法做到这一点?我没有看到任何广播意图,我可以登记在清单中。

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问题有关重新启动对升级报警;它展示了如何使用ACTION_PACKAGE_REPLACED意图看,当一个应用程序的升级。

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.

阅读全文

相关推荐

最新文章