How to get runtime time permissions using android management API?

360 Views Asked by At

I am using the Android Management API to get runtime permission android.permission.SYSTEM_ALERT_WINDOW. The app is going to be installed on fully managed devices. The policy has the below permissions defined:-

defaultPermissionPolicy: "GRANT"

I have added this to the application section of the policy as well. However, the app does not obtain these permissions and the user has to manually go to the settings and enable this permission. I understand that this permission is rated as advanced level permission, but this is a fully managed device.

3

There are 3 best solutions below

0
On

To fully benefit from android.permission.SYSTEM_ALERT_WINDOW, it's usually necessary to request also Draw over other apps which is special permission that the user must grant manually per app. It's nicely described here.

0
On

Android Management API defaultPermissionPolicy can only grant/deny runtime permission requests. For example, READ_CONTACTS, WRITE_CONTACTS, ACCESS_FINE_LOCATION, ACCESS_COARSE_LOCATION and etc.

SYSTEM_ALERT_WINDOW is a special permission. This permission doesn't behave like a dangerous or normal permission. This is a sensitive permission that needs user authorization.

For more information you may refer to this link.

0
On

I had the same problem with AE. The solution was set targetSdkVersion to 19 in your app.