try {
String cmd5=”dmesg”;
Process process = Runtime.getRuntime().exec(cmd5);
Log.i(TAG,”cmd dmesg success–“);
InputStream in1 = process.getInputStream();
BufferedReader reader1 = new BufferedReader(new InputStreamReader(in1));
String line1;
Log.i(TAG,”cat value–“+reader1.readLine());
}
in1.close();
} catch (IOException ex) {
addr.setText(“error”);
}
直接用adb调用是没问题的,为何apk调用dmesg命令时,获取的返回值为空,是不是要加什么权限,还是本人调用的方法不对,请高手指点
String cmd5=”dmesg”;
Process process = Runtime.getRuntime().exec(cmd5);
Log.i(TAG,”cmd dmesg success–“);
InputStream in1 = process.getInputStream();
BufferedReader reader1 = new BufferedReader(new InputStreamReader(in1));
String line1;
Log.i(TAG,”cat value–“+reader1.readLine());
}
in1.close();
} catch (IOException ex) {
addr.setText(“error”);
}
直接用adb调用是没问题的,为何apk调用dmesg命令时,获取的返回值为空,是不是要加什么权限,还是本人调用的方法不对,请高手指点
解决方案
80
有些命令只有system app才能拿到结果的