Class AnalyticsConsent

java.lang.Object
com.codename1.analytics.AnalyticsConsent

public final class AnalyticsConsent extends Object
An immutable snapshot of the consent the user has granted, broken down by category so that an application can honour granular choices (for example allowing crash reporting while declining behavioural analytics). Instances are created through granted(), denied() or builder() and handed to Analytics.setConsent(AnalyticsConsent).
  • 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

    • granted

      public static AnalyticsConsent granted()

      A consent object granting every category. Convenient when the user has accepted a single all-encompassing consent prompt.

      Returns

      consent with all categories granted

    • denied

      public static AnalyticsConsent denied()

      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

    • builder

      public static AnalyticsConsent.Builder builder()

      Creates a builder seeded with all categories denied.

      Returns

      a new builder

    • asBuilder

      public AnalyticsConsent.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