AmplitudeAnalyticsService
class AmplitudeAnalyticsService(amplitude: Amplitude) : AnalyticsLifecycleService, IdentifiableUserService, ConsentService(source)
Amplitude's lifecycle and identity, over an Amplitude the consumer owns.
Amplitude starts itself when it is constructed, from a Configuration you build — API key, server zone, autocapture and everything else it offers are set there. start only waits for that build to finish.
Before consent arrives, Amplitude collects. Its default is opted in. Build it opted out instead, and setEnabled opts in:
val amplitude = Amplitude(Configuration(apiKey, context, optOut = true))Content copied to clipboard
Amplitude does not persist the opt-out: every launch starts from the Configuration, so re-apply the stored consent decision after start-up.