Noby
Noby

Reputation: 6612

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

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

Upvotes: 7

Views: 12621

Answers (3)

Tony Thian
Tony Thian

Reputation: 79

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.

Upvotes: 0

Yury
Yury

Reputation: 20936

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.

Upvotes: 6

Bill Gary
Bill Gary

Reputation: 3005

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

Upvotes: 1

Related Questions