Android SDK
Android SDK - Privacy & Consent
GDPR / DMA consent and GAID handling for the FunnelMob Android SDK.
The Android SDK exposes a setConsent API for GDPR / DMA, and a Limit Ad Tracking parameter on setGAID for advertising-ID consent. Both are opt-in — if you configure neither, the SDK tracks normally.
GDPR / DMA consent
Pass a FunnelMobConsent to record the user's decision. Field shape mirrors Google Consent Mode v2 and AppsFlyer's AppsFlyerConsent:
val consent = FunnelMobConsent(
isUserSubjectToGDPR = true,
hasConsentForDataUsage = true,
hasConsentForAdsPersonalization = false,
hasConsentForAdStorage = true,
)
FunnelMob.setConsent(consent)| Field | Effect on the SDK |
|---|---|
isUserSubjectToGDPR | When false, the per-dimension flags are advisory and the SDK tracks normally. |
hasConsentForDataUsage | When false and isUserSubjectToGDPR == true, the SDK stops dispatching events/sessions/identify and purges its local queue. |
hasConsentForAdsPersonalization | Forwarded to ad networks (Google ad_personalization). Does not gate dispatch. |
hasConsentForAdStorage | Forwarded to ad networks (Google ad_storage). Does not gate dispatch. |
setConsent can be called any time — before or after start(). When called, the SDK schedules a session re-fire so the backend learns the new consent state without waiting for the next app launch.
Consent revocation
When the user revokes consent (hasConsentForDataUsage = false with isUserSubjectToGDPR = true):
- New
trackEvent(...)calls are dropped. - Pending events are removed from memory and from
SharedPreferencespersistence. - In-flight HTTP requests still complete (we can't recall data already on the wire). Server-side erasure is the deletion API's job, not the SDK's.
Google Advertising ID (GAID) and Limit Ad Tracking
The SDK does not read GAID itself — your host application reads it via Google Play Services' AdvertisingIdClient and passes it in. To honor the user's "Delete advertising ID" / "Limit Ad Tracking" setting, pass the LAT flag:
val info = AdvertisingIdClient.getAdvertisingIdInfo(context)
FunnelMob.setGAID(
gaid = info.id,
isLimitAdTrackingEnabled = info.isLimitAdTrackingEnabled,
)If isLimitAdTrackingEnabled is true, the SDK drops the GAID even if a value was supplied — this prevents leaking the identifier when an upstream call site forgot to check the flag itself.
The default value is false, so existing call sites that don't pass the parameter continue to work unchanged.
"Wait for everything" pattern (consent banner / strict consent)
If you need the SDK to do absolutely nothing until the user has accepted a banner, use autoStart = false:
val config = FunnelMobConfiguration.Builder("fm_live_abc123")
.autoStart(false)
.build()
FunnelMob.initialize(applicationContext, config)
// after the user accepts your banner:
FunnelMob.setConsent(consent)
FunnelMob.start()With autoStart = false, the SDK wires up internal state but performs no network activity until you call start(). This is stricter than setConsent alone and is the recommended pattern for hosts that need a pre-init consent gate.