Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - how to send crash reports?

It seems that as of Android 2.2, there is a new feature for sending crash reports, as mentioned in the links:

  • http://www.androidcentral.com/new-android-app-crash-report-tool-already-and-running
  • http://android-developers.blogspot.com/2010/05/google-feedback-for-android.html
  • http://developer.android.com/sdk/android-2.2-highlights.html
  • http://www.youtube.com/watch?v=o8unC9bA4O8

How do I use this feature? Is it automatic for each application downloaded from the market (aka Google Play Store)? Where can I find more info about this feature?

Also, is it possible to customize what is being sent, perhaps by using DefaultExceptionHandler, and put our own description of the crash?

NOTE: i know that there are plenty of tools for sending crash reports (like ACRA) , but i wish to check first if it's possible to use what's already given.

EDIT: I've succeeded modifying the exception that is passed further, hoping that this will also change the report that is sent to the developer website of Google.

Here's a sample code that is relevant for this:

private static class DefaultExceptionHandler implements java.lang.Thread.UncaughtExceptionHandler
...
@Override
public void uncaughtException(Thread t, Throwable e)
{
  final StackTraceElement[] exceptionStackTrace = e.getStackTrace();
  Exception exception = new Exception("my new exception!", e);
  final StackTraceElement[] newExceptionStackTrace = new StackTraceElement[exceptionStackTrace.length + 1];
  System.arraycopy(exceptionStackTrace, 0, newExceptionStackTrace, 1, exceptionStackTrace.length);
  newExceptionStackTrace[0] = new StackTraceElement("TEST CLASS", "TEST METHOD", "TEST FILE", 0);
  exception.setStackTrace(newExceptionStackTrace);
_defaultUEH.uncaughtException(t, exception); //this will hopefully call the default handling of the exception for reporting
}
like image 692
android developer Avatar asked May 30 '12 11:05

android developer


1 Answers

What you have described sounds like the build in feature, and as far as I know, you cannot customize this. The data will be send to the googlePlay dev account which uploaded the app. I have seen customizations made by Sense, or Custom Roms. The only way to get your own Logs, is to use the DefaultErrorHandler you mentioned. As a good practice I would check, if you can catch the error yourself, (maybe log it somewhere). If not I would rethrow this error, to give the user a chance to give you hints , what he has done

like image 155
Rafael T Avatar answered Oct 21 '22 04:10

Rafael T