Question

I found how to detect uninstall event and test following code.

In Receiver.java:

    @Override
public void onReceive(Context context, Intent intent) {
    String action = intent.getAction();
    Log.d(TAG, "received broadcast : " + action);
}

In manifest.xml:

<receiver android:name="....base.BaseAppReceiver">
            <intent-filter>
                <action android:name="android.intent.action.PACKAGE_REMOVED"/>
                <data android:scheme="package"/> 
            </intent-filter>
        </receiver>

But it detected when only other app was uninstalled. I want to do something before uninstalling "my" app not "other" app. Please, Let me know how can my app detect uninstalling event for processing something before uninstalling my app if it can.

Was it helpful?

Solution

This is not possible, sorry. If you put your files in the proper directories, they will be deleted automatically, but no other work can be done when your app is uninstalled.

OTHER TIPS

You can not listen your own uninstall event. Just think about that You are trying to call any class that is going to be uninstalled, how could it be possible?

If you want to implement, then you need to make one more application called WatchDog which will take care for your application when it gets uninstalled..

Hope it will help you..!!!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top