android / enterprise-samples

Multiple samples showing the best practices in enterprise on Android.
Apache License 2.0
387 stars 241 forks source link

BasicManagedProfile sample not working on Android 10 #28

Closed mcfoi closed 4 years ago

mcfoi commented 4 years ago

While the sample woks flawlessly on Android 8.1, on Android 10 the creation of a Work Profile stars anc completes but no DEVICE_ADMIN_ENABLED event is never captured by the BasicDeviceAdminReceiver. As a consequence the Work Profile is never enabled.

EDIT: adding more detail. I tryed bypassing the receiver (BasicDeviceAdminReceiver) whose only purpose is starting the Profile enabling process in EnableProfileActivity. In this class just two things are done:

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.android.basicmanagedprofile/com.example.android.basicmanagedprofile.EnableProfileActivity}: java.lang.SecurityException: No active admin ComponentInfo

lintz18 commented 4 years ago

Have you found the solution? I have the same issue

mcfoi commented 4 years ago

Have you found the solution? I have the same issue

No. I gave up any attempt as is something clearly related with some constraints in recent Android platforms.. ..so nothing we can do about until is somewhat documented. Sorry!

lintz18 commented 4 years ago

Hey, I've found a solution. In case it helps you : Repo TestDPC

Working on Android 10.