Search code examples
javaandroidacra

How to use ACRA to send custom reports?


ACRA allows you to send reports when an application is destroyed. How to use it to send a report during the necessary moment? For example, in block:

    try {
        // some code
    } catch (Exception e) {
        // send custom report with exception stack trace
    }

Solution

  • Initialize ACRA:

    ACRA.init(this);
    ErrorReporter.getInstance().addReportSender(new CustomReportSender());
    

    Try to use following:

        try {
            // some code
        } catch (Exception e) {
            ErrorReporter.getInstance().handleException(e);
        }