How to configure a CUSTOM_DATA field with a couchdb ?
I want to set a config value to send with with the error. In the back end I have a couch db with an ACLARYZER web app.
This is the code on my Application.class in Android where I defined this custom data value.
@ReportsCrashes(
formUri = "https://user.cloudant.com/acra-report/_design/acra-storage/_update/report",
reportType = HttpSender.Type.JSON,
httpMethod = HttpSender.Method.POST,
formUriBasicAuthLogin = "user",
formUriBasicAuthPassword = "pass",
formKey = "", // This is required for backward compatibility but not used
customReportContent = {
ReportField.APP_VERSION_CODE,
ReportField.APP_VERSION_NAME,
ReportField.ANDROID_VERSION,
ReportField.PACKAGE_NAME,
ReportField.REPORT_ID,
ReportField.BUILD,
ReportField.STACK_TRACE,
ReportField.CUSTOM_DATA
},
mode = ReportingInteractionMode.TOAST,
resToastText = R.string.reporte_error
)
public class my_applicaction extends Application{
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
ACRA.init(my_applicaction.this);
ACRA.getErrorReporter().putCustomData("myKey", "myValue");
ACRA.getErrorReporter().handleException(null);
}
}
Now the question is how to add the value in the couch db to get this custom data field. Or I have to define the custom data in the ACRALYZER?
thanks
Finally it's more easy than I can imagine.
Simply put this line with every CUSTOM_DATA
ACRA.getErrorReporter().putCustomData("NAME_VALUE1", "VALUE1");
Then your code is somthing like this.
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
ACRA.init(Application.this);
ACRA.getErrorReporter().putCustomData("NAME_VALUE1", "VALUE1");
ACRA.getErrorReporter().putCustomData("NAME_VALUE2", "VALUE2");
ACRA.getErrorReporter().putCustomData("NAME_VALUE3", "VALUE3");
}
The ACLARYZER do the rest.
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