Skip to main content
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

MethodTypeDefaultDescription
credential(write_key)StringWrite key from the Android Source.
enableLogging(enable)BooleanfalseIf true, displays info / debug / warning / error logs.
optOut(value)BooleanfalseMaster kill switch. If true, no events are posted to SPL. Fallback when consent is not used.
MethodTypeDefaultDescription
useConsent(consent)BooleanfalseIf true, the SDK waits for a consent signal before recording events.
checkForCMP(is_CMP_available)BooleanfalseIf true with useConsent, the SDK reads TCF data stored by other CMPs.
checkZeotapVendorConsent(boolean)BooleanfalseIf true, the SDK requires Zeotap Vendor consent when resolving GDPR consent.
roleForConsent(consent_role)RoleForConsentRoleForConsent.PUBLISHER or RoleForConsent.VENDOR.
tcfPublisherConsentCategory(publisher_category)PublisherConsentCategoryPublisherConsentCategory.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

MethodTypeDefaultDescription
areIdentitiesHashed(isHashed)BooleanfalseSet true if your setUserIdentities calls already supply hashed PII keys.
hashIdentities(hash)BooleanfalseIf 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

MethodTypeDefaultDescription
batchSize(size)Integer30Max events in the unsent queue before next batch dispatches. Min 10, max 50.
maxCacheSize(size)Integer100Max events stored locally during network failures or delayed consent. Max 200.
serviceUploadInterval(interval)Integer90Seconds between scheduled dispatches when the queue is below the batch threshold.

Region

MethodTypeDefaultDescription
userCountry(country_code)StringnullAlpha-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);
Last modified on June 22, 2026