升级 Android 上正在运行的应用程序

发布于 2024-11-12 08:08:20 字数 433 浏览 3 评论 0原文

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

末が日狂欢 2024-11-19 08:08:20

Android系统是否应该在应用程序运行时升级时重新启动应用程序?

我不知道预期的行为应该是什么。但我知道它不会重新启动应用程序。因此,我有一个 BroadcastReceiver 等待 ACTION_PACKAGE_REPLACED 意图,然后相应地处理应用程序重新启动。

Is Android system supposed to restart an application when it's upgraded while it's running?

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 the ACTION_PACKAGE_REPLACED intent and then handle the app restart accordingly.

薆情海 2024-11-19 08:08:20

据我所知。
看起来像是要重新启动。但真正的过程是:应用程序被卸载,然后使用升级版本再次安装。因为卸载了,当然会自动关闭。

在您的情况下,您的应用程序似乎不想关闭,因此卸载过程不会进行。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文