-
- All Implemented Interfaces:
-
android.content.SharedPreferences.OnSharedPreferenceChangeListener,java.lang.Thread.UncaughtExceptionHandler,org.acra.ErrorReporter
public final class ErrorReporterImpl implements Thread.UncaughtExceptionHandler, SharedPreferences.OnSharedPreferenceChangeListener, 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, which may then be sent.
-
-
Field Summary
Fields Modifier and Type Field Description private final SenderSchedulerreportScheduler
-
Constructor Summary
Constructors Constructor Description ErrorReporterImpl(Application context, CoreConfiguration config, Boolean enabled, Boolean supportedAndroidVersion, Boolean checkReportsOnApplicationStart)
-
Method Summary
Modifier and Type Method Description SenderSchedulergetReportScheduler()StringputCustomData(String key, String value)Use this method to provide the ErrorReporter with data of your running application. StringremoveCustomData(String key)Removes a key/value pair from your reports custom data field. UnitclearCustomData()Removes all key/value pairs from your reports custom data field. StringgetCustomData(String key)Gets the current value for a key in your reports custom data field. UnituncaughtException(Thread t, Throwable e)UnithandleSilentException(Throwable e)Send a silent report for the given exception UnitsetEnabled(Boolean enabled)Enable or disable this ErrorReporter. UnithandleException(Throwable e, Boolean endApplication)Send a normal report for the given exception UnithandleException(Throwable e)Send a normal report for the given exception. UnitonSharedPreferenceChanged(SharedPreferences sharedPreferences, String key)final Unitunregister()-
-
Constructor Detail
-
ErrorReporterImpl
ErrorReporterImpl(Application context, CoreConfiguration config, Boolean enabled, Boolean supportedAndroidVersion, Boolean checkReportsOnApplicationStart)
- Parameters:
context- Context for the application in which ACRA is running.config- AcraConfig to use when reporting and sending errors.enabled- Whether this ErrorReporter should capture Exceptions and forward their reports.supportedAndroidVersion- the minimal supported versioncheckReportsOnApplicationStart- If reports should be checked on startup
-
-
Method Detail
-
getReportScheduler
SenderScheduler getReportScheduler()
-
putCustomData
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).
- Parameters:
key- A key for your custom data.value- The value associated to your key.
-
removeCustomData
String removeCustomData(String key)
Removes a key/value pair from your reports custom data field.
- Parameters:
key- The key of the data to be removed.
-
clearCustomData
Unit clearCustomData()
Removes all key/value pairs from your reports custom data field.
-
getCustomData
String getCustomData(String key)
Gets the current value for a key in your reports custom data field.
- Parameters:
key- The key of the data to be retrieved.
-
uncaughtException
Unit uncaughtException(Thread t, Throwable e)
-
handleSilentException
Unit handleSilentException(Throwable e)
Send a silent report for the given exception
- Parameters:
e- The Throwable to be reported.
-
setEnabled
Unit setEnabled(Boolean enabled)
Enable or disable this ErrorReporter. By default it is enabled.
- Parameters:
enabled- Whether this ErrorReporter should capture Exceptions and forward them as crash reports.
-
handleException
Unit handleException(Throwable e, Boolean endApplication)
Send a normal report for the given exception
- Parameters:
e- The Throwable to be reported.endApplication- if you want the application to be ended after sending the report.
-
handleException
Unit handleException(Throwable e)
Send a normal report for the given exception.
- Parameters:
e- The Throwable to be reported.
-
onSharedPreferenceChanged
Unit onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key)
-
unregister
final Unit unregister()
-
-
-
-