Configure the SDK by chaining CollectOptions.builder(this) methods, then call .build() to produce the options object passed to Collect.init().
CollectOptions options = CollectOptions.builder(this)
.credential("YOUR_WRITE_KEY")
.useConsent(true)
.checkForCMP(true)
.hashIdentities(true)
.userCountry("DEU")
.build();
Collect.init(options);
Core options
| Method | Type | Default | Description |
|---|
credential(write_key) | String | — | Write key from the Android Source. |
enableLogging(enable) | Boolean | false | If true, displays info / debug / warning / error logs. |
optOut(value) | Boolean | false | Master kill switch. If true, no events are posted to SPL. Fallback when consent is not used. |
Consent
| Method | Type | Default | Description |
|---|
useConsent(consent) | Boolean | false | If true, the SDK waits for a consent signal before recording events. |
checkForCMP(is_CMP_available) | Boolean | false | If true with useConsent, the SDK reads TCF data stored by other CMPs. |
checkZeotapVendorConsent(boolean) | Boolean | false | If true, the SDK requires Zeotap Vendor consent when resolving GDPR consent. |
roleForConsent(consent_role) | RoleForConsent | — | RoleForConsent.PUBLISHER or RoleForConsent.VENDOR. |
tcfPublisherConsentCategory(publisher_category) | PublisherConsentCategory | — | PublisherConsentCategory.CONSENTS or LEGITIMATEINTERESTS. |
purposesForTracking(tracking_ids) | List<Integer> | Arrays.asList(1, 3, 4) | TCF purpose IDs that gate tracking. See TCF policies. |
purposesForIdentifying(identification_ids) | List<Integer> | Arrays.asList(1, 9) | TCF purpose IDs that gate identification. |
For the full consent walkthrough see Consent Resolution.
Identity & hashing
| Method | Type | Default | Description |
|---|
areIdentitiesHashed(isHashed) | Boolean | false | Set true if your setUserIdentities calls already supply hashed PII keys. |
hashIdentities(hash) | Boolean | false | If true, raw PII passed to setUserIdentities is hashed by the SDK before being sent. |
Both flags apply only to PII fields. Custom identities (crmID, etc.) are always sent as-is.
Event delivery
| Method | Type | Default | Description |
|---|
batchSize(size) | Integer | 30 | Max events in the unsent queue before next batch dispatches. Min 10, max 50. |
maxCacheSize(size) | Integer | 100 | Max events stored locally during network failures or delayed consent. Max 200. |
serviceUploadInterval(interval) | Integer | 90 | Seconds between scheduled dispatches when the queue is below the batch threshold. |
Region
| Method | Type | Default | Description |
|---|
userCountry(country_code) | String | null | Alpha-ISO3 country code sent as user.user_country. Defaults to IP-derived country. |
A complete example
CollectOptions options = CollectOptions.builder(this)
.credential("YOUR_WRITE_KEY")
.enableLogging(false)
.useConsent(true)
.checkForCMP(false) // custom consent flow
.hashIdentities(true)
.areIdentitiesHashed(false)
.batchSize(30)
.maxCacheSize(100)
.serviceUploadInterval(90)
.userCountry("DEU")
.purposesForTracking(Arrays.asList(1, 3, 4))
.purposesForIdentifying(Arrays.asList(1, 9))
.build();
Collect.init(options);