Reputation:
I am working on app for Point of Sale. I need to disable or hide or ignore user to delete any app. Is there any way to do that?
Upvotes: 0
Views: 1040
Reputation: 81
Try this way:
DevicePolicyManager dpm = (DevicePolicyManager) getSystemService(Context.DEVICE_POLICY_SERVICE);
ComponentName cn = new ComponentName(context, AdminReceiver.class);
dpm.setUninstallBlocked(cn, packageName, isEnabled);
or
dpm.addUserRestriction(cn, UserManager.DISALLOW_UNINSTALL_APPS);
It needs admin permission (or device owner)
Upvotes: 1