Hi
I'm trying to writing a android service which will read system logs
real time. I defined two class, main.class and myservice.class.
main.class is used to manager the service (start and stop the
service).
The reading process is as following:
process = Runtime.getRuntime().exec("logcat");
bufferedReader = new BufferedReader( new
InputStreamReader(process.getInputStream()), 1024);
String line = bufferedReader.readLine();
while(line != null) {
Log.i("LOG", line);
}
Code above will just display the logs from command logcat.
But when i ran the application and start the service, the android
system becoming slowly and bombs a window asking me to do a option
quit or wait to the application? If a choose quit, then the service
will be paused and stopped soon.
I think the question occurs when reading logs cause the exec("logcat")
will be running until the service is stopped, so it takes more and
more memory and the system has to stopped the application and service.
so, how should i do the reading process to avoid the situation
mentioned above?
Any one could help me? Thanks.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en