简体   繁体   中英

su vs system-app ( for shutdown / reboot -p )

I want to shutdown one android device via code. I can do so with

su reboot -p

But now I want to do this with my app that is signed with the system key without the need for rooting the device - but strangely I get:

reboot: Operation not permitted

Anyone can point me in the right direction

Don't use a su command. Use Android's native methods. PowerManager has a method reboot() as documented here: Android doc

Full code example here

Hope this helps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM