Share via


How to shutdown the android device programmatically?

Question

Friday, February 7, 2020 7:40 PM

A few customer launcher apps provide a way to shutdown / restart the android device with some custom button in their UI. I am working on a experimental launcher app, and would like to have a way to shutdown / restart the device, but the documentation out there says that it is not possible with the newer android api's. Any solution / ideas will be appreciated.

All replies (4)

Monday, February 10, 2020 11:10 AM âś…Answered

@LandLu said: I think this could only be achieved with rooted devices. And we should try to avoid involving this kind of feature in our applications. This should be controlled by the user or it will break the user experience. In fact, the shut down permission can only be set in some system applications: https://stackoverflow.com/a/14065879/8354952

you can do this on some enterprise devices like zebra, using their tools


Friday, February 7, 2020 8:35 PM

Consumer device or enterprise like Zebra devices?


Saturday, February 8, 2020 2:37 AM

I meant consumer devices such as android phone or tablet...


Monday, February 10, 2020 10:37 AM

I think this could only be achieved with rooted devices. And we should try to avoid involving this kind of feature in our applications. This should be controlled by the user or it will break the user experience. In fact, the shut down permission can only be set in some system applications: https://stackoverflow.com/a/14065879/8354952