[Pls Help] How to run shell command from code in non-rooted Android phones?
I'm new to Android development and I'm writing my very first Android apps but recently I have encounter the below problem:
I want to call reboot command in non-rooted phone but as you know, reboot command needs root permission.
I want my app to run in both rooted and non-rooted phones. For rooted phones there is no problem.
However for non-rooted phones, I am trying to find a way to restart it without root permission.
I have been thinking of calling shell command in non-rooted phones (E.g, adb shell reboot
), but I don't know how to put the script file
to an apk file and excecute the script within java code.
Therefore I'd like to ask for your help to solve this problem.
Thank you very much