How to know my app is uninstalled from the device...?
11,290
Solution 1
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.
Solution 2
You cannot tell when someone uninstalls your app unless you keep track on the statistics in android market. And unless you have only a few installs, that may prove difficult
Comments
-
Noby about 2 years
I have an app installed in many devices.
If app is uninstalled from any of the device I need an indication.
How to achieve this.
Thanks in advance...!
-
mseo over 12 yearsThen there's no way to do it.
-
Noby over 12 yearsI am in search of programmatic approach for the same task.
-
Bill Gary over 12 yearsyou CANNOT know when a device uninstalls your app programatically lol
-
Noby over 12 yearsDo I need in add this into my app...?
-
Noby over 12 yearsMy main activity is different. If I place this code my launcher activity will not launch when app started...!
-
Yury over 12 yearsYep, of coarse you should modify the code. Here I've showed just permissions that you need and intent-filter.
-
Kishore over 11 yearsits not lol..!! It is done already by McAfee, NQ and many others.
-
Seshu Vinay over 9 years@BillGary its also done by UC Browser. It opens a webpage when app is uninstalled. I don't know what made you lol.
-
Vivek Elangovan about 9 yearsHi @Yury I want to send a mail to specific mail id wen user click on uninstall button.. Can u pls help me out..
-
Sam about 7 yearsI just tested this in Android 7.1.1 and it didn't work.
-
portfoliobuilder over 3 yearsThese permissions are only granted to system apps