如何知道我的应用程序已从设备上卸载...? [英] How to know my app is uninstalled from the device...?

查看:27
本文介绍了如何知道我的应用程序已从设备上卸载...?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在许多设备上都安装了一个应用程序.

I have an app installed in many devices.

如果从任何设备上卸载了应用程序,我需要一个指示.

If app is uninstalled from any of the device I need an indication.

如何实现这一点.

提前谢谢...!

推荐答案

我的建议如下.您可以拦截应用程序卸载的意图.只需将以下代码放入清单文件中:

My proposal will be the following. You can intercept the intent for your application uninstall. Simply put the following code in your manifest file:

<uses-permission android:name="android.permission.INSTALL_PACKAGES" />
<uses-permission android:name="android.permission.DELETE_PACKAGES" />
<uses-permission android:name="android.permission.CLEAR_APP_CACHE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.CLEAR_APP_USER_DATA" />

<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name" >
    <activity
        android:name=".UninstallIntentActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <action android:name="android.intent.action.DELETE" />
            <category android:name="android.intent.category.DEFAULT" />
            <data android:scheme="package" android:pathPattern="com.testpack.yourapp" />
        </intent-filter>



    </activity>

</application>

在此之后,您可以以某种方式处理您的应用程序将被删除(例如,向您发送电子邮件),并调用包管理器卸载程序.

After this you can somehow process that your application is going to be deleted (for instance, send you a email), and call the package manager uninstaller.

这篇关于如何知道我的应用程序已从设备上卸载...?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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