I am going to remove the application when the user clicks a button. with this code:
Uri packageURI = Uri.parse("package:" + pkNames[position]); Intent uninstallIntent = new Intent( Intent.ACTION_DELETE, packageURI); context.startActivity(uninstallIntent);
but some applications are not uninstalled. for example Setting or Music or ... when I am going to uninstall these applications, I see: uninstall failed.
I get my packages using this code:
Intent mainIntent = new Intent(Intent.ACTION_MAIN, null); mainIntent.addCategory(Intent.CATEGORY_LAUNCHER); packages = pm.queryIntentActivities(mainIntent, 0);
How can I detect if an application has been deleted or not?
source share