Android 以编程方式隐藏或禁用应用程序管理
我正在为销售点开发应用程序。我需要禁用或隐藏或忽略用户删除任何应用程序。 有什么方法可以做到这一点吗?试试这种方法:Android 以编程方式隐藏或禁用应用程序管理,android,settings,Android,Settings,我正在为销售点开发应用程序。我需要禁用或隐藏或忽略用户删除任何应用程序。 有什么方法可以做到这一点吗?试试这种方法: DevicePolicyManager dpm = (DevicePolicyManager) getSystemService(Context.DEVICE_POLICY_SERVICE); ComponentName cn = new ComponentName(context, AdminReceiver.class); dpm.setUninstallBlocked(cn
DevicePolicyManager dpm = (DevicePolicyManager) getSystemService(Context.DEVICE_POLICY_SERVICE);
ComponentName cn = new ComponentName(context, AdminReceiver.class);
dpm.setUninstallBlocked(cn, packageName, isEnabled);
或
它需要管理员权限(或设备所有者)
dpm.addUserRestriction(cn, UserManager.DISALLOW_UNINSTALL_APPS);