I am making an EMM application. This application will only be installed in firm's devices only. Is there any way to grant below permissions programmatically through DevicePolicyManager.
- android.permission.SYSTEM_ALERT_WINDOW (Display over other apps)
- android.permission.BIND_ACCESSIBILITY_SERVICE (Accessibility service)
- android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS (Ignore battery optimization)
I want to grant above permissions through DevicePolicyManager as my app is a system owner app. But, I can't grant them through devicePolicyManager.setPermissionGrantState. As I have also tried devicePolicyManager.setPermittedAccessibilityServices for granting ACCESSIBILY_SERVICE programmatically, but it also didn't work. So, is there is any way I can grant above all permissions programmatically without navigating to that screen and turn in on manually. Or Is there is a way so that user cannot be able to disable the above features anyway. Like when I enable location and other permissions through DevicePolicyManager user is unable to turn it off.