i'm trying to reboot my android device (doing android porting) for test.
my code :
try {
Runtime rt = Runtime.getRuntime();
Process proc = rt.exec("reboot");
InputStream is = proc.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String line;
while ((line = br.readLine()) != null) {
Log.i("runtime","line : " + line);
}
} catch (Throwable t) {
t.printStackTrace();
}
but the device didn't reboot itself.
if i change the command to
Runtime rt = Runtime.getRuntime();
Process proc = rt.exec("ls");
it ran fine , show all dir.
and when i input "reboot" in adb shell , it also worked. why???
reboot is just one of toolbox commands, I also run other command which can work from shell. But, none of them can work from rt.exec except 'ls'. Could some one tell me how to make it works from android runtime ? Thanks