I want to clean up the junk created by my application at time on UnInstalling
the Application.
Using ManiFest File:-
Added in Manifest File:
<receiver android:name="com.netdoers.com.ui.CleanReceiver" >
<intent-filter>
<action android:name="android.intent.action.PACKAGE_REMOVED" >
</action>
<data android:scheme="package"/>
</intent-filter>
</receiver>
Created Receiver to catch the BroadCast Event
public class CleanReceiver extends BroadcastReceiver
{
public void onReceive(Context context, Intent intent) {
CustomToast.showToastMessage(context, "Uninstalling Application");
Log.e("Uninstall", "CleanReceiver Called");
}
}
In Java Code:-
BroadCastReceiver br = new CleanReceiver();
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(Intent.ACTION_PACKAGE_REMOVED);
intentFilter.addDataScheme("package");
registerReceiver(br, intentFilter);
But at time of Uninstalling application the receiver is never been called.
Both Java and Manifest never call Receiver at event of Uninstall application. How to catch the broadcast event at time of Uninstalling application?