如何关闭一个Android手机编程? [英] How to shutdown an android mobile programatically?

查看:134
本文介绍了如何关闭一个Android手机编程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能关闭手机编程。 这是与出使用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

这篇关于如何关闭一个Android手机编程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆