[英]I am making an app and want to know when the app is uninstalling
I am making an app and want to know when the app is uninstalling. 我正在制作一个应用程序,想知道何时卸载该应用程序。 For doing it, I used BroadcastReceiver but I don't know where is my code is wrong?
为此,我使用了BroadcastReceiver,但是我不知道我的代码在哪里错误? (when my app is uninstalling, BroadcastReceiver can't receive any message about uninstalling) It's my app's Manifest:
(当我的应用程序正在卸载时,BroadcastReceiver不会收到任何有关卸载的消息)这是我的应用程序的清单:
<receiver android:name="receiver">
<intent-filter>
<action android:name="android.intent.action.PACKAGE_ADDED"/>
<action android:name="android.intent.action.PACKAGE_DATA_CLEARED"/>
<action android:name="android.intent.action.PACKAGE_INSTALL"/>
<action android:name="android.intent.action.UID_REMOVED"/>
<action android:name="android.intent.action.PACKAGE_REMOVED"/>
<action android:name="android.intent.action.MEDIA_REMOVED"/>
<action android:name="android.intent.action.MEDIA_BAD_REMOVAL"/>
<action android:name="android.intent.action.BATTERY_OKAY"/>
<data android:scheme="com.example.testpermission"/>
</intent-filter>
You can't, but if you have second installed application on the device - you can get notification via that application about the uninstallation of the first one (as far as I remember). 您不能,但是如果您在设备上安装了第二个应用程序,则可以通过该应用程序收到有关第一个应用程序卸载的通知(据我所记得)。
I believe that the application cannot monitor its own uninstall from two reasons: 我认为该应用程序无法监视其自身的卸载有两个原因:
About how to do it from second app: Your second app should be a receiver to the ACTION_PACKAGE_REMOVED event (read about BroadcastReceiver, and see: http://developer.android.com/reference/android/content/Intent.html#ACTION_PACKAGE_REMOVED ) 关于如何从第二个应用程序执行操作:您的第二个应用程序应该是ACTION_PACKAGE_REMOVED事件的接收者(有关BroadcastReceiver的信息,请参阅: http : //developer.android.com/reference/android/content/Intent.html#ACTION_PACKAGE_REMOVED )
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.