-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Custom Extensions
Mike Hardy edited this page Mar 26, 2019
·
6 revisions
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 are Collector
, ReportInteraction
, ReportingAdministrator
, ReportSenderFactory
and ConfigurationBuilderFactory
.
Choose one of the following alternatives:
Add the following dependencies to your build.gradle
:
compileOnly "com.google.auto.service:auto-service-annotations:1.0-rc5"
annotationProcessor "com.google.auto.service:auto-service-annotations:1.0-rc5"
Then annotate your extension with the following:
@AutoService(Extension.class)
E.g.
@AutoService(ReportingAdministrator.class)
public MyAdmin implements ReportingAdministrator {
See ServiceLoader for manual provider registration