This is what worked for me using ACRA 4.5.0 with the HttpSender backend. I am using Acralyzer in Cloudant.
Source:
@ReportsCrashes( mode = ReportingInteractionMode.DIALOG, resDialogText = R.string.crash_dialog_text, resDialogCommentPrompt = R.string.crash_dialog_comment_prompt, formUri = "https://kpc.cloudant.com/acra-openconnect/_design/acra-storage/_update/report", formUriBasicAuthLogin="[restricted reporter login]", formUriBasicAuthPassword="[restricted reporter password]", reportType = org.acra.sender.HttpSender.Type.JSON, httpMethod = org.acra.sender.HttpSender.Method.PUT, formKey = "" ) public class Application extends android.app.Application { public void onCreate() { super.onCreate(); ACRA.init(this);
My application stores a circular buffer in memory with log messages. This is not written to disk, and I didn’t really want to display it on a line and call putCustomData () every time a record was added. So instead, I call my static "dumper" method, VPNLog.dumpLast (), to modify the report just before running HttpSender.send (). The new code is as follows:
@ReportsCrashes( mode = ReportingInteractionMode.DIALOG, resDialogText = R.string.crash_dialog_text, resDialogCommentPrompt = R.string.crash_dialog_comment_prompt, formUri = "https://kpc.cloudant.com/acra-openconnect/_design/acra-storage/_update/report", formUriBasicAuthLogin="[restricted reporter login]", formUriBasicAuthPassword="[restricted reporter password]", // reportType and httpMethod are now defined below formKey = "" ) public class Application extends android.app.Application { public void onCreate() { super.onCreate(); ACRA.init(this); ACRA.getErrorReporter().setReportSender( new HttpSender(org.acra.sender.HttpSender.Method.PUT, org.acra.sender.HttpSender.Type.JSON, null) { @Override public void send(CrashReportData report) throws ReportSenderException { report.put(ReportField.APPLICATION_LOG, VPNLog.dumpLast()); super.send(report); } });
The value I'm adding is a long string (100+ lines); Acralyzer correctly breaks it into separate numbered lines.
Another option is to populate ReportField.CUSTOM_DATA with a few key / value pairs:
report.put(ReportField.CUSTOM_DATA, "key0=value0\nkey1=value1\n");
Acralyzer displays them in an HTML table.