Reputation: 13
I am new to android i would like to know how to disable receiving notification after application is uninstalled, whether any event or something to detect that app is uninstalled ??? i have tried this but not working for me
if(intent.getAction().equals("android.intent.action.PACKAGE_REMOVED")) {
Intent i = new Intent(context,BootReceiver.class);
Identifier = i.getStringExtra("Recognition_flag");
serverUrl = Constants.urlAll + "uninstall.php";
LongOperation serverRequest = new LongOperation();
// serverRequest.execute(serverUrl, user, pass,
// deviceIMEI);
serverRequest.execute(serverUrl, user);
GCMRegistrar.setRegisteredOnServer(context, true);
Log.e(" BroadcastReceiver ", "onReceive called " + " PACKAGE_REMOVED ");
Toast.makeText(context, " onReceive !!!! PACKAGE_REMOVED", Toast.LENGTH_LONG).show();
}
// when package installed
else if (intent.getAction().equals("android.intent.action.PACKAGE_ADDED")) {
Log.e(" BroadcastReceiver ", "onReceive called " + "PACKAGE_ADDED");
Toast.makeText(context, " onReceive !!!!." + "PACKAGE_ADDED", Toast.LENGTH_LONG).show();
}
Upvotes: 0
Views: 179
Reputation: 741
You cannot detect app uninstalls on Android in any easy way. The broadcast android.intent.action.PACKAGE_REMOVED is sent to all the app present in the mobile but yours once the app is removed.
Sure there are ways my company has tracked when the app is uninstalled but thats something very tricky and deep.
Upvotes: 1