|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.acra.ErrorReporter
public class ErrorReporter
The ErrorReporter is a Singleton object in charge of collecting crash context
data and sending crash reports. It registers itself as the Application's
Thread default Thread.UncaughtExceptionHandler
.
When a crash occurs, it collects data of the crash context (device, system, stack trace...) and writes a report file in the application private directory. This report file is then sent :
ReportsCrashes.mode()
is set to
ReportingInteractionMode.SILENT
or
ReportingInteractionMode.TOAST
,ReportsCrashes.mode()
is set
to ReportingInteractionMode.NOTIFICATION
.If an error occurs while sending a report, it is kept for later attempts.
Method Summary | |
---|---|
void |
addCustomData(String key,
String value)
Deprecated. |
void |
addReportSender(ReportSender sender)
Add a ReportSender to the list of active ReportSender s. |
void |
checkReportsOnApplicationStart()
This method looks for pending reports and does the action required depending on the interaction mode set. |
String |
getCustomData(String key)
Gets the current value for a key in your reports custom data field. |
static ErrorReporter |
getInstance()
Deprecated. since 4.3.0 Use ACRA.getErrorReporter()
instead. |
void |
handleException(Throwable e)
Send a report for a Throwable with the reporting interaction mode
configured by the developer, the application is then killed and restarted
by the system. |
void |
handleException(Throwable e,
boolean endApplication)
Send a report for a Throwable with the reporting interaction mode
configured by the developer. |
void |
handleSilentException(Throwable e)
Send a report for this Throwable silently (forces the use of
ReportingInteractionMode.SILENT for this report, whatever is the
mode set for the application. |
String |
putCustomData(String key,
String value)
Use this method to provide the ErrorReporter with data of your running application. |
void |
removeAllReportSenders()
Clears the list of active ReportSender s. |
String |
removeCustomData(String key)
Removes a key/value pair from your reports custom data field. |
void |
removeReportSender(ReportSender sender)
Remove a specific instance of ReportSender from the list of
active ReportSender s. |
void |
removeReportSenders(Class<?> senderClass)
Remove all ReportSender instances from a specific class. |
void |
setDefaultReportSenders()
Sets relevant ReportSenders to the ErrorReporter, replacing any previously set ReportSender. |
void |
setEnabled(boolean enabled)
Enable or disable this ErrorReporter. |
void |
setReportSender(ReportSender sender)
Removes all previously set ReportSender s and set the given one as
the new ReportSender . |
void |
uncaughtException(Thread t,
Throwable e)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static ErrorReporter getInstance()
ACRA.getErrorReporter()
instead.
IllegalStateException
- if ACRA.init(android.app.Application)
has not yet
been called.@Deprecated public void addCustomData(String key, String value)
putCustomData(String, String)
.
key
- A key for your custom data.value
- The value associated to your key.public String putCustomData(String key, String value)
Use this method to provide the ErrorReporter with data of your running application. You should call this at several key places in your code the same way as you would output important debug data in a log file. Only the latest value is kept for each key (no history of the values is sent in the report).
The key/value pairs will be stored in the GoogleDoc spreadsheet in the "custom" column, as a text containing a 'key = value' pair on each line.
key
- A key for your custom data.value
- The value associated to your key.
removeCustomData(String)
,
getCustomData(String)
public String removeCustomData(String key)
key
- The key of the data to be removed.
putCustomData(String, String)
,
getCustomData(String)
public String getCustomData(String key)
key
- The key of the data to be retrieved.
putCustomData(String, String)
,
removeCustomData(String)
public void addReportSender(ReportSender sender)
ReportSender
to the list of active ReportSender
s.
sender
- The ReportSender
to be added.public void removeReportSender(ReportSender sender)
ReportSender
from the list of
active ReportSender
s.
sender
- The ReportSender
instance to be removed.public void removeReportSenders(Class<?> senderClass)
ReportSender
instances from a specific class.
senderClass
- ReportSender class whose instances should be removed.public void removeAllReportSenders()
ReportSender
s. You should then call
addReportSender(ReportSender)
or ACRA will not send any report
anymore.
public void setReportSender(ReportSender sender)
ReportSender
s and set the given one as
the new ReportSender
.
sender
- ReportSender to set as the sole sender for this ErrorReporter.public void uncaughtException(Thread t, Throwable e)
uncaughtException
in interface Thread.UncaughtExceptionHandler
public void handleSilentException(Throwable e)
Throwable
silently (forces the use of
ReportingInteractionMode.SILENT
for this report, whatever is the
mode set for the application. Very useful for tracking difficult defects.
e
- The Throwable
to be reported. If null the report will
contain a new Exception("Report requested by developer").public void setEnabled(boolean enabled)
enabled
- Whether this ErrorReporter should capture Exceptions and
forward them as crash reports.public void checkReportsOnApplicationStart()
public void handleException(Throwable e, boolean endApplication)
Throwable
with the reporting interaction mode
configured by the developer.
e
- The Throwable
to be reported. If null the report will
contain a new Exception("Report requested by developer").endApplication
- Set this to true if you want the application to be ended after
sending the report.public void handleException(Throwable e)
Throwable
with the reporting interaction mode
configured by the developer, the application is then killed and restarted
by the system.
e
- The Throwable
to be reported. If null the report will
contain a new Exception("Report requested by developer").public void setDefaultReportSenders()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |