How to call power off,reboot dialog from application?

前端 未结 2 510
野趣味
野趣味 2021-01-23 04:38

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,powe

相关标签:
2条回答
  • 2021-01-23 05:15

    It is not possible programatically due to security restriction

    • Similar Question
    0 讨论(0)
  • 2021-01-23 05:22

    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.

    0 讨论(0)
提交回复
热议问题