1

I had used the code below to lock the device, and turn the device screen light off.

I need to unlock the device and turn the screen light ON by a single tap on the device screen.

val policyManager =context.getSystemService(Context.DEVICE_POLICY_SERVICE) as DevicePolicyManager
val adminReceiver = ComponentName(context, KioskAdmin::class.java!!)
val admin = policyManager.isAdminActive(adminReceiver)
if (admin) {
    Log.i("TURN_OFF", "Going to sleep now.")
    policyManager.lockNow()
}
Banana
  • 2,435
  • 7
  • 34
  • 60

0 Answers0