Android: Effecient way to read logcat output

2019-02-19 04:02发布

How can one read the output of a running process in the most efficient manner

Let me explain what i am trying to achieve.

I am trying to read logcat via my app on the phone

i want to make it such that any update in the logcat is instantly reflected and the app is efficient , like less battery consumption.

2条回答
Root(大扎)
2楼-- · 2019-02-19 04:27

android-logger may be of interest to you. Its an open source app that allows you to read logcat from an app on your phone. I'm sure you will find the code you need in this app.

查看更多
beautiful°
3楼-- · 2019-02-19 04:29

Options:

  1. Eclipse. There is a "logCat" view you can add Window->Show View...->Other->Android->LogCat.
  2. ADB. Use the android debugger console. Run "adb logcat" (this is the same as #1 but without eclipse).

To be efficient:

  1. Don't log too much in the app!
  2. Use filters. In eclipse's logCat you can filter by text, tag, etc...
  3. Battery doesn't matter. The log is output over USB (which should be allowing you to charge anyway!)
查看更多
登录 后发表回答