在将应用替换为另一个应用之前,有什么方法可以得到通知吗? [英] Is there any way to get notified before the app is being replaced by another?

查看:96
本文介绍了在将应用替换为另一个应用之前,有什么方法可以得到通知吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我了解 ACTION_MY_PACKAGE_REPLACED 意图操作,但该怎么做?它的用途是-通知接收方之后该应用已替换.

I know about the ACTION_MY_PACKAGE_REPLACED Intent action but what it do is - notifies the receiver AFTER the app got replaced.

但是事情是-我想在将该应用替换为另一个应用之前知道.

我尝试了这些操作

<receiver
    android:name=".receivers.InstallReceiver"
    android:enabled="true"
    android:exported="true">

       <intent-filter>
            <action android:name="android.intent.action.PACKAGE_INSTALL" />
            <action android:name="android.intent.action.PACKAGE_ADDED" />
            <action android:name="android.intent.action.PACKAGE_CHANGED" />
            <action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
       </intent-filter>
</receiver>

但无济于事!

推荐答案

我想知道该应用被其他应用替换之前

I want to know before the app is being replaced by another

这不可能,抱歉.

如果我要在卸载应用程序之前停止某些服务怎么办?

What if I want to stop some service before the app got uninstalled?

当替换或删除某个应用程序时,其过程将终止.该过程也会由于许多其他原因而终止(例如,年老,在设置中强制停止).对于替换/卸载方案,无需做任何特殊的事情.

When an app is replaced or removed, its process is terminated. The process will be terminated for many other reasons as well (e.g., old age, Force Stop in Settings). There should be no need to do something special for the replacement/uninstall scenario.

这篇关于在将应用替换为另一个应用之前,有什么方法可以得到通知吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆