SDK Android:如何为设备打开关机/重新启动对话框 [英] SDK Android : How to open Shutdown/Reboot dialog for the device
问题描述
我是新来的。
我有一个问题,我尝试关闭一个4.2.2的Android设备(不是root)。
I have a problem, i try to shutdown a 4.2.2 android device (not root).
我知道 ACTION_SHUTDOWN
不适用于unroot设备。
I know that ACTION_SHUTDOWN
not works with unroot device.
所以我想打开现有的关机/重新启动/飞机对话框,我们在维护开/关按钮时得到的对话框。然后用户只需点击关机按钮。
So i want to open the existing shutdown/reboot/airplane dialog, the same we get when we maintain the on/off button. Then the user just have to click shutdown button.
我尝试通过这种方式创建,没有结果...
I try to create by this way, without result...
Intent intent = new Intent(Settings.ACTION_DISPLAY_SETTINGS); // or others settings
startActivity(intent);
谢谢,
推荐答案
没有公共的sdk访问权限以编程方式打开电源按钮菜单。
此链接包含所有的批注。模拟电源按钮按下显示关闭对话框
The is no public sdk access to open the power button menu programatically.
This link has all the approches Here.Simulating power button press to display switch off dialog box
这篇关于SDK Android:如何为设备打开关机/重新启动对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!