How to call power off,reboot dialog from application?

你离开我真会死。 提交于 2019-12-04 04:49:59

问题


I would like to call power off,reboot, etc.. dialog as same as default android dialog when push power button long from my application.
I no need to call directly reboot,power off, etc... from my application.
Just would like to call that dialog.
How to call it ? or How to send power button key on application ?
Thanks in advance.


回答1:


If you look at the source code, you'll see it's handled internally (PhoneWindowManager.java and GlobalActions.java). There is no interface whatsoever through the API. In short: Can't be done.

If you have the REBOOT permission, you can reboot the phone directly with PowerManager.reboot(), but it is very unlikely that a public app would need this functionality. I wouldn't trust an app with the REBOOT permission.




回答2:


It is not possible programatically due to security restriction

  • Similar Question


来源:https://stackoverflow.com/questions/4791790/how-to-call-power-off-reboot-dialog-from-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!