How to put Android to standby programmatically?

后端 未结 3 1488
暖寄归人
暖寄归人 2021-01-05 08:17

Is it somehow possible to set Android to standby-mode programmatically ?

3条回答
  •  情深已故
    2021-01-05 08:54

    http://developer.android.com/reference/android/os/PowerManager.html#goToSleep%28long%29

    This is what i think you are looking for. Don't forget to include following permission.

    android.permission.DEVICE_POWER
    

提交回复
热议问题