Android SDK: Consent and controls
All Ad80 methods are safe to call from any thread and never throw.
Initialization and start
Section titled “Initialization and start”The SDK initializes itself through AndroidX App Startup; you do not need any code for it. Start-up only registers lifecycle callbacks on the main thread; the manifest is read and the SDK is built on its own background thread.
If your app disables App Startup, or removes the AD80 initializer, call Ad80.initialize(context) yourself, early,
for example in Application.onCreate(). It is idempotent.
<provider android:name="androidx.startup.InitializationProvider" android:authorities="${applicationId}.androidx-startup" android:exported="false" tools:node="merge"> <meta-data android:name="dev.ad80.sdk.Ad80Initializer" tools:node="remove" /></provider>class MyApp : Application() { override fun onCreate() { super.onCreate() Ad80.initialize(this) // only needed when App Startup does not run the AD80 initializer }}public class MyApp extends Application { @Override public void onCreate() { super.onCreate(); Ad80.initialize(this); // only needed when App Startup does not run the AD80 initializer }}Consent
Section titled “Consent”Nothing is captured or sent until consent is granted. Consent is not stored by the SDK: call
Ad80.setConsent(...) on every app start, as soon as you know the user’s choice, for example after your consent
flow (such as Google’s User Messaging Platform) finishes.
import dev.ad80.sdk.Ad80
// After your consent flow, on every start:Ad80.setConsent(consentInformation.canRequestAds())import dev.ad80.sdk.Ad80;
// After your consent flow, on every start:Ad80.setConsent(consentInformation.canRequestAds());consentInformation is your UMP ConsentInformation; use whatever decides consent in your app.
Revoking consent (Ad80.setConsent(false)) stops capture and requests at once and deletes everything queued on
the device. Nothing queued before the revocation is ever sent later.
Local kill switch
Section titled “Local kill switch”| How | Effect |
|---|---|
Ad80.setEnabled(false) | Turns the SDK off for this process: stops capture and upload and deletes the queue. Ad80.setEnabled(true) turns it on again. Not stored across processes. |
<meta-data android:name="dev.ad80.ENABLED" android:value="false" /> | The SDK is inert for the whole process: it starts no thread, captures nothing and reports Disabled(MANIFEST). Use it, for example, in a build flavor that must not report ads. |
Ad80.setEnabled(false) // for example from a remote flag or a settings screenAd80.setEnabled(false); // for example from a remote flag or a settings screenRemote configuration (AD80’s kill switch)
Section titled “Remote configuration (AD80’s kill switch)”The SDK reads its remote configuration. Once consent is granted and the SDK is enabled, it fetches its configuration from AD80 (GET /v1/config on the
endpoint) and again after each ttlSeconds:
{ "enabled": true, "captureEnabled": true, "uploadEnabled": true, "ttlSeconds": 3600, "fullScreenCaptureEnabled": true }| Field | Effect |
|---|---|
enabled | false stops capture and upload and deletes the queue. It stays in force, also after a restart, until a later configuration enables the SDK again. The SDK keeps checking the configuration meanwhile. |
captureEnabled | false stops capturing new ads. |
uploadEnabled | false stops uploads. |
fullScreenCaptureEnabled | false skips full-screen ads (outcome SKIPPED_FULLSCREEN_DISABLED) and drops queued full-screen observations that were not yet delivered. It only matters for ads your app tracks with Ad80.trackFullScreenAd. Capture needs enabled, captureEnabled and this field all true. Owners and admins can switch it for each app in the dashboard, under Apps and SDK setup. |
ttlSeconds | How long the configuration is valid. The SDK keeps it between 300 and 86400 seconds. |
If a fetch fails, the SDK keeps using the last configuration it received (the defaults above when it never received one, except that full-screen capture stays off until a configuration arrives) and tries again after 15 minutes, waiting longer after each further failure, up to a day.
The stored switch is on by default for each app, but the SDK itself starts with fullScreenCaptureEnabled off and treats
a missing or malformed field as off, so full-screen capture begins only after the SDK has fetched a configuration that
turns it on.
On the Free plan the configuration has enabled: false, so an SDK built into an app stays idle until the
organization moves to a plan with SDK integration. AD80 can also pause an app for you; write to
contact@ad80.dev.