Support for custom headers in ACRA

92 views
Skip to first unread message

Rama Palaniappan

unread,
Feb 2, 2013, 4:54:43 AM2/2/13
to acra-d...@googlegroups.com
Hi,

I would like to add custom http headers before sending the crash report from the
device.

Is there a way to do this without editing acra's source code to do this. I'm ok
to extend ACRA.

I would want to do something like this: Get values for apiKey and trafficType
from config and set it in HttpHeader before sending the crash.

@ReportsCrashes(
formUri = "https://some.server/some-uri", formKey = "",
apiKey="xyz",
trafficType="live")
public class MyApplication extends Application {...

I could create a separate sender to set httpHeaders, but I don't know how to get
values for apiKey and trafficType from config without changing the source of
ReportsCrashes annotation class.

Regards,
Ram


Guido García

unread,
May 5, 2016, 3:01:42 AM5/5/16
to acra-discuss, rama.pal...@gmail.com
Same question here. Is it possible to add your own http headers to the crash report?
Thank you.

William Ferguson

unread,
May 5, 2016, 7:33:36 PM5/5/16
to acra-discuss, rama.pal...@gmail.com
There are a couple of ways to do this.

If the headers will be the same for all reports then just configure them using ConfigurationBuilder.setHttpHeaders(Map<String, String> headers)

If you need to change the headers depending upon the specifics of the crash report then implement your own ReportSender, ReportSenderFactory.

William
Reply all
Reply to author
Forward
0 new messages