How to enable a non-marketed application in a managed profile (Android 5.0) programmatically

Hello, I was checking Android 5.0 samples, there was a BasicManagedProfile sample. Using this, I successfully created a managed profile. But he only managed Market applications (downloadable from Google Play) as a managed application. But I tried with custom to say this HelloWOrld application, which is not available on the Market. This gave me the error "java.lang.IllegalArgumentException: only system applications can be enabled."

devicePolicyManager.enableSystemApp( BasicDeviceAdminReceiver.getComponentName(activity), packageName); 

which I used to enable the application. Is there a way or API to enable a user application in a managed profile.

+5
source share
2 answers

After searching for many days, I found that google did not currently provide APIs / methods for including a nonmarket application in a managed profile.

+5
source

Managed users cannot install non-market applications in Lollipop, programmatically or manually. There is a spam error report about manual mode.

However, there is a workaround for development / personal use. Just install the application with adb install after creating a managed user. The application will be installed for both users.

+1
source

Source: https://habr.com/ru/post/1208641/


All Articles