Class AnalyticsConsent
all(), none() or builder()
and handed to Analytics.setConsent(AnalyticsConsent). An application
that has already collected consent elsewhere can unblock everything in one
line: Analytics.setConsent(AnalyticsConsent.all()).-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic AnalyticsConsentall()A consent object granting every category.Returns a builder seeded with this object's current values so a single category can be toggled without rebuilding from scratch.static AnalyticsConsent.Builderbuilder()Creates a builder seeded with all categories denied.static AnalyticsConsentdenied()Alias fornone(); denying every category.static AnalyticsConsentgranted()Alias forall(); granting every category.booleanConsent for advertising / ad storage.booleanConsent for screen views, events and user properties.booleanConsent for crash and exception reporting.booleanConsent for personalization (e.g. user-level identification).static AnalyticsConsentnone()A consent object denying every category.
-
Method Details
-
isAnalytics
public boolean isAnalytics()Consent for screen views, events and user properties.
Returns
true if behavioural analytics collection is permitted
-
isCrashReporting
public boolean isCrashReporting()Consent for crash and exception reporting.
Returns
true if crash reporting is permitted
-
isPersonalization
public boolean isPersonalization()Consent for personalization (e.g. user-level identification).
Returns
true if personalization is permitted
-
isAdStorage
public boolean isAdStorage()Consent for advertising / ad storage.
Returns
true if ad storage is permitted
-
all
A consent object granting every category. Use this when the application has already obtained consent through its own mechanism (a custom prompt, a third-party consent-management platform, an enterprise MDM policy, or a jurisdiction where the integrator has determined consent is not required) and simply wants reporting to flow:
// app handled consent elsewhere -- unblock all categories at startup Analytics.setConsent(AnalyticsConsent.all());For apps that would rather not gate at all, see
Analytics.setConsentMode(ConsentMode)withConsentMode.OPT_OUT.Returns
consent with all categories granted
-
none
A consent object denying every category. Equivalent to the implicit state before consent is recorded in
ConsentMode.OPT_IN.Returns
consent with all categories denied
-
granted
-
denied
-
builder
Creates a builder seeded with all categories denied.
Returns
a new builder
-
asBuilder
Returns a builder seeded with this object's current values so a single category can be toggled without rebuilding from scratch.
Returns
a builder pre-populated from this instance
-