Mus*_*adi 11 android android-logcat android-log
我需要从Android中的调制解调器无线电日志中捕获一些信息,但我不知道如何捕获它.我搜索了很多,但没有找到.因为我需要一些关于basebandandroid的信息,我发现必须捕获调制解调器日志.
提前致谢.
编辑
我在应用程序中以编程方式找到了读取logcat以捕获应用程序中的logcat日志
但因为它是adb日志adb logcat -b radio我不知道如何捕获ADB登录应用程序.正如我在一条评论中看到的那样,我怀疑是否有可能.
谢谢
尝试这样的事情:
try {
Runtime rt = Runtime.getRuntime();
//here you can add your params
String[] commands = {"logcat"};
Process proc = rt.exec(commands);
BufferedReader stdInput = new BufferedReader(new
InputStreamReader(proc.getInputStream()));
BufferedReader stdError = new BufferedReader(new
InputStreamReader(proc.getErrorStream()));
String s;
while ((s = stdInput.readLine()) != null) {
//here is your logcat
Log.i("logcat", s);
}
while ((s = stdError.readLine()) != null) {
Log.e("logcat", s);
}
} catch (IOException e) {
e.printStackTrace();
}
Run Code Online (Sandbox Code Playgroud)
请记住,您可能需要 root 才能读取 logcat。
UPD:工作示例 - https://github.com/sssemil/SampleLogcatApp
| 归档时间: |
|
| 查看次数: |
4042 次 |
| 最近记录: |