iOS SDK: Consent and controls
Every Ad80 method never throws and never traps on your input. start, register and unregister are @MainActor:
call them on the main thread. The other methods are safe to call from any thread.
Initialization and start
Section titled “Initialization and start”Nothing starts by itself on iOS. Call Ad80.start(integrations:) once, from
application(_:didFinishLaunchingWithOptions:), before the first ad view appears.
The first call reads Info.plist (AD80PublisherKey, AD80Endpoint, AD80Enabled), builds the SDK and starts
observation. It makes no network request before consent. A later call only installs integrations that are not
installed yet and changes nothing else: configuration, consent, enablement and placements stay as they are.
import UIKitimport GoogleMobileAdsimport Ad80import Ad80GoogleMobileAds
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { Ad80.start(integrations: [Ad80GoogleMobileAds.integration]) MobileAds.shared.start(completionHandler: nil) return true}A SwiftUI app has no app delegate by default, so add one:
@main struct MyApp: App { @UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate var body: some Scene { WindowGroup { ContentView() } }}Call Ad80.start(integrations:) in that delegate’s application(_:didFinishLaunchingWithOptions:), as in the UIKit
tab. Banner views wrapped in a UIViewRepresentable are found like any other BannerView once they are in a window.
Keep the representable’s view the Google view itself, with nothing of your own inside it.
@import Ad80GoogleMobileAds;@import Ad80;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [AD80GoogleMobileAds startAD80]; return YES;}Ad80.start() without an integration starts the SDK without Google Mobile Ads discovery: it reports
adMobUnavailable once and observes only views you register yourself.
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 Ad80
// After your consent flow, on every start:Ad80.setConsent(consentInformation.canRequestAds)[AD80 setConsent:YES];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 (the SDK reports disabled(CONSENT_REVOKED)). 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 (disabled(LOCAL)). Ad80.setEnabled(true) turns it on again. Not stored across processes. |
AD80Enabled set to false (Boolean) in Info.plist | The SDK is inert for the whole process: it captures nothing and reports disabled(INFO_PLIST). Use it, for example, in a build configuration that must not report ads. Absent means enabled. |
Ad80.setEnabled(false) // for example from a remote flag or a settings screen[AD80 setEnabled:NO];Remote 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.