How to enable Non market application in Managed Profile (Android 5.0) programmatically

自闭症网瘾萝莉.ら 提交于 2019-12-05 01:24:23

问题


Hello I was checking Android 5.0 samples there was sample BasicManagedProfile. Using that I have created managed profile successfully. But it was managing only Market applications (Downloaded from Google Play) as managed application. But I tried with custom say it HelloWOrld application that is not available on Market. It gave me the error " java.lang.IllegalArgumentException: Only system apps can be enabled this way."

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

code that i was using to enable application. Is there any way or API to enable Custom application in Managed Profile.


回答1:


After searching for many days I found that currently google has not provided any API/ methods to enable non-market application in managed profile.




回答2:


Managed users cannot install non market apps in Lollipop, programmatically or manually. There's a spammy bug report about the manual way.

However, there's a workaround for development/personal use. Just install your app with adb install after the managed user creation. The app will be installed for both users.



来源:https://stackoverflow.com/questions/27375736/how-to-enable-non-market-application-in-managed-profile-android-5-0-programmat

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!