编程关闭Android设备 [英] shut down android device programmatically
本文介绍了编程关闭Android设备的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想通过我的程序关掉Android设备。它实际上被关闭,但它重新启动。我希望手机不要被自己再次重新启动。我该怎么办呢?
I am trying to switch off android device through my program. It actually gets switched off but it restarts itself. I want the phone not to restart again by itself. How can I do that?
推荐答案
这已被要求在计算器中来。有效答案是,你将需要 DEVICE_POWER
权限才能关上了手机完全关闭,但用户将需要一个根深蒂固的手机给你的应用程序权限的控制呢
This has been asked on StackOverflow in the past. The effective answer is that you would require the DEVICE_POWER
permission in order to shut the phone completely off, but the user would need a rooted phone to give your app permission to that control anyway.
最好的,你可以希望的是 PowerManager.goToSleep()
Best you could hope for is PowerManager.goToSleep()
这篇关于编程关闭Android设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文