|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.acra.sender.HttpPostSender
public class HttpPostSender
The ReportSender
used by ACRA when ReportsCrashes.formUri()
has been defined in order to post crash data to a custom server-side data
collection script. It sends all data in a POST request with parameters named
with easy to understand names (basically a string conversion of
ReportField
enum values) or based on your own conversion Map from
ReportField
values to String.
To use specific POST parameter names, you can provide your own report fields mapping scheme:
@ReportsCrashes(...) public class myApplication extends Application { public void onCreate() { ACRA.init(this); Map<ReportField, String> mapping = new HashMap<ReportField, String>(); mapping.put(ReportField.APP_VERSION_CODE, "myAppVerCode'); mapping.put(ReportField.APP_VERSION_NAME, "myAppVerName'); //... mapping.put(ReportField.USER_EMAIL, "userEmail'); // remove any default report sender ErrorReporter.getInstance().removeAllReportSenders(); // create your own instance with your specific mapping ErrorReporter.getInstance().addReportSender(new ReportSender("http://my.domain.com/reports/receiver.py", mapping)); super.onCreate(); } }
Constructor Summary | |
---|---|
HttpPostSender(Map<ReportField,String> mapping)
Create a new HttpPostSender instance with its destination taken from ACRA.getConfig() dynamically. |
|
HttpPostSender(String formUri,
Map<ReportField,String> mapping)
Create a new HttpPostSender instance with a fixed destination provided as a parameter. |
Method Summary | |
---|---|
void |
send(CrashReportData report)
Send crash report data. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public HttpPostSender(Map<ReportField,String> mapping)
Create a new HttpPostSender instance with its destination taken from
ACRA.getConfig()
dynamically. Configuration changes to the
formUri are applied automatically.
mapping
- If null, POST parameters will be named with
ReportField
values converted to String with
.toString(). If not null, POST parameters will be named with
the result of mapping.get(ReportField.SOME_FIELD);public HttpPostSender(String formUri, Map<ReportField,String> mapping)
Create a new HttpPostSender instance with a fixed destination provided as a parameter. Configuration changes to the formUri are not applied.
formUri
- The URL of your server-side crash report collection script.mapping
- If null, POST parameters will be named with
ReportField
values converted to String with
.toString(). If not null, POST parameters will be named with
the result of mapping.get(ReportField.SOME_FIELD);Method Detail |
---|
public void send(CrashReportData report) throws ReportSenderException
ReportSender
send
in interface ReportSender
report
- Stores key/value pairs for each report field. A report field
is identified by a ReportField
enum value.
ReportSenderException
- If anything goes fatally wrong during the handling of crash
data, you can (should) throw a ReportSenderException
with a custom message.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |