升级 Android 上正在运行的应用程序
Android系统在应用程序运行时升级时是否应该重新启动应用程序?
当我们升级应用程序(通过从 SD 卡打开 .apk)并且应用程序正在运行时,现有进程将保留,并且升级不会生效,直到我们从应用程序管理器“强制关闭”应用程序。然而,应用程序可能处于某种奇怪的状态,并且可能无法响应它应该响应的某些意图。所以我想知道如果我们修复特定的损坏状态,应用程序是否会重新启动,或者我们是否需要自己处理升级。
请注意,我 知道(或者至少有一些想法)如何以编程方式检测升级。我想知道的是,如果应用程序处于正常状态,我是否应该这样做,或者是否有其他机制应该这样做。
Is Android system supposed to restart an application when it's upgraded while it's running?
When we upgrade our application (by opening the .apk from SD card) and the application is running, the existing process stays around and the upgrade does not take effect until we "force close" the application from application manager. However it is likely that the application is in some weird state and may not respond to some intents it should. So I want to know whether the application would be restarted if we fix that particular broken state or whether we need to handle the upgrade ourselves.
Note, that I know (or at least have some ideas) how to detect the upgrade programmatically. What I want to know is whether I am supposed to or whether there is some other mechanism that should do it if the application is in a sane state.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不知道预期的行为应该是什么。但我知道它不会重新启动应用程序。因此,我有一个
BroadcastReceiver
等待ACTION_PACKAGE_REPLACED
意图,然后相应地处理应用程序重新启动。I dont know what should be the expected behaviour. But I know that it does not restart the app. So I have a
BroadcastReceiver
waiting for theACTION_PACKAGE_REPLACED
intent and then handle the app restart accordingly.据我所知。
看起来像是要重新启动。但真正的过程是:应用程序被卸载,然后使用升级版本再次安装。因为卸载了,当然会自动关闭。
在您的情况下,您的应用程序似乎不想关闭,因此卸载过程不会进行。
as far as I know.
it's looks like restarting. but the real process is : the application got uninstalled then installed again with the upgraded version. because it is uninstalled , of course it will automatically closed.
in your case it seems your application don't want to close and the so uninstall process not going.