I want to create an app to restart my phone. My motivation for this is because my power button is broken. This is my current code (stderr doesn't print to console by default, only exceptions do):
_reboot() {
Process.run('reboot',['-p']).then((ProcessResult results) {
print("stdout: \n" + results.stdout + "stderr:\n" + results.stderr);
});
}
Which outputs the error:
I/flutter (24139): stdout:
I/flutter (24139): stderr:
I/flutter (24139): shutdown: Permission denied
So I have two questions:
su
and sudo
commands don't exist on my Android version.I think you need Root. Can you try?
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.