How to power off an Android device programmatically -
how can power off android device programmatically?
i searched answer, said phone must rooted (i don't want that), , others said it's impossible.
is impossible?
you can't unless have rooted phone. easy calling shutdown command linux:
void shutdown() { try { process m_process=runtime.getruntime().exec("su"); dataoutputstream os = new dataoutputstream(m_process.getoutputstream()); os.writebytes("shutdown\n"); os.flush(); m_process.waitfor(); } catch (exception e) { // todo auto-generated catch block e.printstacktrace(); } }
Comments
Post a Comment