2

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.

tknv
  • 562
  • 1
  • 6
  • 23

2 Answers2

1

It is not possible programatically due to security restriction

Community
  • 1
  • 1
jmj
  • 237,923
  • 42
  • 401
  • 438
  • Funny though, you can directly reboot the device (without any confirmation) if you have the REBOOT permission. That said, I'm not sure if that dialog the OP is asking for is hooked up to an intent, or if the intent if part of the API. It may not be, meaning that each manufacturer could have its own custom solution. – EboMike Jan 25 '11 at 09:41
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.

EboMike
  • 76,846
  • 14
  • 164
  • 167
  • Thank you very much,Jigar and EboMike. I wouldn't trust an app with the REBOOT permission too and understand "In short: Can't be done". I will just show warning message "please reboot bra bra bra..." on my application. – tknv Jan 26 '11 at 05:22