Programatically turn off phone

rfresh

Well-Known Member
Licensed User
Longtime User
I've searched around and cannot find any information to programatically turn off my phone. Can someone please point me to any documentation or examples on how to do this? I don't want to root my phone in order to do this.

Thanks...
 
Yes, I looked this page over pretty good but did not see any mention of being able to turn your phone off by code.
 
Upvote 0
If this is an app you are making for rooted devices, then this can be
done with a

su
reboot

commands...


Otherwise, non-rooted apps, this cannot be performed:

"Only system applications and applications signed with the same key that was used to sign the firmware will be able to get that permission."
 
Upvote 0
If this is an app you are making for rooted devices, then this can be
done with a

su
reboot

commands...


Otherwise, non-rooted apps, this cannot be performed:

"Only system applications and applications signed with the same key that was used to sign the firmware will be able to get that permission."

Is the same true for turning on a phone? Can we turn on a phone using code?
 
Upvote 0
If this is an app you are making for rooted devices, then this can be
done with a

su
reboot

commands...


Otherwise, non-rooted apps, this cannot be performed:

"Only system applications and applications signed with the same key that was used to sign the firmware will be able to get that permission."

Isn't there a way in code to trigger the OS event as if the power button were pressed and held, thus causing the shutdown dialog to popup?
 
Upvote 0
Back
Top