如何关闭一个Android手机编程?手机、Android

2023-09-12 08:00:40 作者:心中曾经难舍弃

是否有可能关闭手机编程。 这是与出使用su命令。

Is it possible to shutdown the mobile programatically. that is with out using su commands..

推荐答案

你可能使用电源管理器,使它重新启动(这并不能保证它会重新启动 - 操作系统可能会取消):

You could possibly use the PowerManager to make it reboot (this does not guarantee that it'll reboot - OS may cancel it):

的http://developer.android.com/reference/android/os/PowerManager.html#reboot(java.lang.String)

这需要重启权限:

的http://developer.android.com/reference/android/Manifest.permission.html#REBOOT

您还可以检查您的logcat试图启用/禁用键盘锁时,并张贴有什么呢?

Can you also check your logcat when trying to enable/disable keyguard, and post what's there?

您不能从一个普通的SDK应用程序做到这一点。只有系统固件签名密钥签名的应用程序可以做到这一点。

You cannot do this from an ordinary SDK application. Only applications signed with the system firmware signing key can do this