I downloaded the App Management Sample app from https://partner.samsungknox.com/dashboard/sample-apps
I added my License in Constants.java
and I run it on my Samsung Galaxy Tab A (M.Y. 2016 with Android 6)
When it tries running I got:
Installation did not succeed. The application could not be installed: INSTALL_FAILED_DUPLICATE_PERMISSION
It turns out that the problem is related to:
<permission
android:name="com.example.supportlibclient.SUPPORT_PERMISSION"
android:label="Support permission"
android:protectionLevel="signature" />
Any modification to this permission definition (removing it, changing the permission name, etc.) makes the app run, but it leads to a java.lang.SecurityException: Admin does not have android.permission.sec.MDM_APP_MGMT
when I want to install, uninstall, disable enable an application.
For example, when setDisableApplication is called, a SecurityException is catched.
private void disablePackage(String packageName) {
EnterpriseDeviceManager enterpriseDeviceManager =
EnterpriseDeviceManager.getInstance(this.getApplicationContext());
ApplicationPolicy appPolicy = enterpriseDeviceManager.getApplicationPolicy();
try {
boolean appDisabled = appPolicy.setDisableApplication(packageName);
mUtils.log(getResources().getString(R.string.disabled_app_result, appDisabled));
} catch (SecurityException e) {
mUtils.processException(e, TAG);
}
}
Any idea about how to fix this? It seems a basic problem, and I cannot understand why the sample app is not working.
Thanks