Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to put Android to standby programmatically?

Tags:

java

android

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

like image 501
HardCoder Avatar asked Mar 16 '12 09:03

HardCoder


2 Answers

If you're developing your own ROM or you have a rooted phone (it's need to be checked which user is able to do this) then you should have a look to the PowerManager.goToSleep functionality. Here is a discussion about this function in the Google Groups. And here you can read about this particular permission.

like image 136
Yury Avatar answered Nov 04 '22 05:11

Yury


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
like image 1
Vipul Avatar answered Nov 04 '22 05:11

Vipul