-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Custom Extensions
F43nd1r edited this page May 19, 2021
·
6 revisions
Documentation has moved! Visit acra.ch for versions 5.8 forward
Create a class extending one of the supported interfaces.
It has to be public
and have a zero-argument public constructor (as a result, it cannot be an inner class).
E.g.
public MyAdmin implements ReportingAdministrator {
public MyAdmin() {
Log.d("MyAdmin", "MyAdmin was loaded");
}
}
Supported Extensions | Use Case |
---|---|
Collector |
Collect additional custom data not covered by acra |
ApplicationStartupCollector |
Collector which is also called at startup |
ReportInteraction |
Usually not needed, as the provided options (dialog, notification, toast) cover all reasonable choices |
ReportingAdministrator |
Control when reports are generated and when the application should be stopped |
ReportSenderFactory |
Register custom report senders |
ConfigurationBuilderFactory |
Register custom configurations |
SenderSchedulerFactory |
Register custom sender scheduler, e.g. to prevent report sending based on custom conditions |
StartupProcessor |
Do something ACRA related on app start |
Choose one of the following alternatives:
Add the following dependencies to your build.gradle
:
compileOnly "com.google.auto.service:auto-service-annotations:1.0-rc6"
annotationProcessor "com.google.auto.service:auto-service:1.0-rc6"
Then annotate your extension with the following:
@AutoService(<Extension>.class)
E.g.
@AutoService(ReportingAdministrator.class)
public MyAdmin implements ReportingAdministrator {
See ServiceLoader for manual service registration