Hi all i just wanted to know if any one knows how i could power off android via java code ?. I have been looking for how to do this but i could not find an answer i hope you guys can help me out here ?.
+2
A:
There is no API in the Android SDK to allow user apps to do this.
The closest you could perhaps try would be PowerManager.goToSleep()
.
Christopher
2010-01-10 19:08:48
let me try that
Johnny Mast
2010-01-10 19:10:42
I know there is this one app called "Power off" but i cant find the source code for that one :(
Johnny Mast
2010-01-10 19:20:42
I think you'd need permission `DEVICE_POWER` which is system only.
Mirko Nasato
2010-01-10 19:29:47
There are apps on the Market that use internal, non-public APIs, or require your phone to be rooted. It's not an advisable approach.
Christopher
2010-01-10 19:31:04