0

I'm trying to start the activity of an app from a foreground service (the activity then starts the lock task mode and essentially "locks" the device). As I'm targeting devices with Android 13+, starting the activity from background requires to follow the instructions introduced after Android 10. Out of them the easiest seemed to me was able to receive the SYSTEM_ALERT_WINDOW permission.

I tried to grant it using the setPermissionGrantState() to the Manifest.permission.SYSTEM_ALERT_WINDOW permission with PERMISSION_GRANT_STATE_GRANTED as grant state from a device owner but it was still revokable in the settings. I later learnt it can't grant system protected permissions.

I had also tried directly modifying the OS default permission policy by using the grantSystemFixedPermissionsToSystemPackage() that also couldn't grant this as a SYSTEM_FIXED permission, it would grant it but not fixed.

DevUt
  • 1,280
  • 11
  • 24

0 Answers0