views:

136

answers:

1

I have an app that is available from the Android Market. Some users have asked for a way of debugging when things don't work out as expected. I have been looking into adding a menu item that will display the output of


    Process mLogcatProc = null;
    BufferedReader reader = null;
    mLogcatProc = Runtime.getRuntime().exec(
        new String[] {"logcat", "-d", "AndroidRuntime:E BDtN:V *:S" });
    reader = new BufferedReader(new InputStreamReader (mLogcatProc.getInputStream()));
    String line;
    ArrayList listOfLogLines = new ArrayList();
    while ((line = reader.readLine()) != null)
    {
        listOfLogLines.add(line);
    }

Basically I am extracting the parts of the Log.* lines that my app has been writing and the errors that the AndroidRuntime has been throwing.

I have a working prototype that will display to the user the contents of the part of the log that I have extracted in a ListView.

I will have to add android.permission.READ_LOGS to the AndroidManifest.xml file in order for my app to have read access to the log, and this of course will be information that the user will be prompted with before installing. And the question is if this is considered impolite, dangerous or otherwise out of the ordinary. Will it keep users from installing?

A: 

I wouldn't install an app that did this. If all you want is your own logs, your app can keep its own private log buffer that it writes into along with the system log.

You may not even need to do this though: http://android-developers.blogspot.com/2010/05/google-feedback-for-android.html

adamp
Thanks. I guess I had a feeling I was doing something wrong there. I'll implement my own log.
Jbruntt