I followed the instructions on setting up the ACRA to send the emails using-
Sending Reports By Email
However can't figured out how to silently send the email to the developer on crash without any email client to choose by the user.
@ReportsCrashes(formKey = "", mailTo = "[email protected]",
customReportContent = { ReportField.ANDROID_VERSION, ReportField.PHONE_MODEL, ReportField.CUSTOM_DATA,
ReportField.STACK_TRACE, ReportField.LOGCAT },
logcatArguments = { "-t", "200", "-v", "long","test:I" ,"*:D","*:S"},
mode = ReportingInteractionMode.SILENT,
reportType=Type.JSON)
With the above setting, I am still getting the default email client to choose from in order to send the crash report.
How to do it directly ?
You can't. The Android framework doesn't allow it.
You can do it via HTTP, if you implemented your own mail service only you need to do this:
create a new class:
public class MyCrashSender implements ReportSender {
@Override
public void send(CrashReportData report) throws ReportSenderException {
// make your http post
// e.g. final HttpPost httpPost = new HttpPost(MY_service_url);
.
.
.
//httpClient.execute(httpPost);
}
}
And then in your activity or you Application when you init acra...
ACRA.init(this);
MyCrashSender crashSender = new MyCrashSender();
ACRA.getErrorReporter().setReportSender(crashSender);
You can attach to http post the primary email of the device.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With