How to know my app is uninstalled from the device...?
Asked Answered
B

3

7

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...!

Braxy answered 31/12, 2011 at 6:13 Comment(7)
where you have to get indication ? in that device or any external device which controls/communicates with all your devices ? Please ask question clearly.Bloodsucker
You mean you want any alert or toast message that say this your application is uninstalled. right ?Bathelda
If it is like that then you already got it while uninstalling it from the device.Bathelda
he wants to know when a user uninstalls his app from their deviceSpline
Android Default behaviour is autometicaly notify user that the xyz app is uninstalled from your device.Bathelda
@Yugandhar Babu I want indication to my server.Braxy
Possible duplicate of Is it possible to detect Android app uninstall?Analgesic
S
6

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.

Sello answered 31/12, 2011 at 7:58 Comment(6)
Do I need in add this into my app...?Braxy
My main activity is different. If I place this code my launcher activity will not launch when app started...!Braxy
Yep, of coarse you should modify the code. Here I've showed just permissions that you need and intent-filter.Sello
Hi @Sello I want to send a mail to specific mail id wen user click on uninstall button.. Can u pls help me out..Bookish
I just tested this in Android 7.1.1 and it didn't work.Analgesic
These permissions are only granted to system appsPhotochronograph
S
1

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

Spline answered 31/12, 2011 at 6:22 Comment(5)
Then there's no way to do it.Scullion
I am in search of programmatic approach for the same task.Braxy
you CANNOT know when a device uninstalls your app programatically lolSpline
its not lol..!! It is done already by McAfee, NQ and many others.Hydrostat
@BillGary its also done by UC Browser. It opens a webpage when app is uninstalled. I don't know what made you lol.Humphreys
K
0

What I did was creating a schedule job by sending an empty message to the device via GCM/FCM, if the response is "NotRegistered" from GCM/FCM then I know that the app has been removed from the device.

I do this "detection" once a day for reporting to show how many devices are still having my app installed.

Kareenkarel answered 21/1, 2021 at 3:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.