Reading logcat on android from c#

放肆的年华 提交于 2019-12-10 18:37:44

问题


I am looking into making a c# program that will read in the logcat output from an android device and read it in to the c# program.

Initially it should do this while the phone is connected and it shouldn't require a specific app on the phone to be installed for the c# program to be able to retrieve the logcat output. Also the phone shouldn't require root access.

Is this something that is possible, I can't find anything on Google that says its possible but thought I'd ask on here in case someone has some useful information.

Thanks for any help you can provide


回答1:


The most practical answer is to execute the shell command 'adb logcat' from your C# program and capture its output.

The only requirement for the device is that USB debugging be enabled in the settings menu.

The host PC will require that the android developer tools and appropriate USB driver for the device be installed. This can, unfortunately involve a substantial amount of hassle, especially finding the right drivers for windows hosts.

More complicated approaches would be to duplicate the functionality of the adb program (it is open source) and/or USB driver in your program, or to install an app on the device with the read logs permission which sends them to you - or even run an ssh server under the app userid so you can connect in and obtain them.



来源:https://stackoverflow.com/questions/11284882/reading-logcat-on-android-from-c-sharp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!