如何以编程方式关闭Android手机? [英] How to shutdown an Android mobile programmatically?

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

问题描述

是否可以通过编程方式关闭移动设备. 无需使用su命令..

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

推荐答案

您可以使用PowerManager使其重新启动(这不能保证它将重新启动-操作系统可能会取消它):

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 )

它需要REBOOT许可:

It requires the REBOOT permission:

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天全站免登陆