Skip to content

Roku SDK: Consent Handling

You can check the current consent status by calling:

statusEnum = SPConsentStatus()
result = m.spEngine.callFunc("getConsentStatus", "YOUR_APPLICATION_ID")
if result.code = 200
status = result.data
if status = statusEnum.PENDING
' Show consent banner
else if status = statusEnum.COLLECTED
' Proceed normally
else if status = statusEnum.RECOLLECTION_REQUIRED
' Trigger re-consent flow
end if
end if

When the SDK determines that consent needs to be recollected (for example, a consent update/re-consent flow), you can fetch the reason by calling:

reasonEnum = SPConsentRecollectionReason()
result = m.spEngine.callFunc("getConsentRecollectionReason", "YOUR_APPLICATION_ID")
if result.code = 200
reason = result.data
if reason = reasonEnum.EXPIRED
' Handle expired
else if reason = reasonEnum.STRUCTURE_CHANGED
' Handle structure change
end if
end if

If no recollection reason is available, result.code will be a non-200 value (e.g., 404).

Case Raw value Meaning
EXPIRED Expired Consent has expired and needs to be re-collected.
STRUCTURE_CHANGED StructureChanged Packages and services hash mismatch.

BrightScript does not have native enum types. The SDK exposes pseudo-enums via global functions that return Associative Arrays. These are the authoritative representation for consent status and recollection reasons. The SDK guarantees these object contracts, but does not guarantee that raw string values remain stable.

Prefer these functions in your app logic:

  • Use them for comparisons
  • Avoid branching on raw string values
  • Map to your own keys if needed
reasonEnum = SPConsentRecollectionReason()
if reason = reasonEnum.EXPIRED
myReasonKey = "MY_EXPIRED"
else if reason = reasonEnum.STRUCTURE_CHANGED
myReasonKey = "MY_STRUCTURE_CHANGED"
end if

The SDK supports three consent states:

  • Collected: Consent has already been obtained.
  • Pending: Consent needs to be collected.
  • RecollectionRequired: Consent needs to be re-collected.
result = m.spEngine.callFunc("getPackage", "YOUR_APPLICATION_ID", "PACKAGE_ID_TO_FIND")
if result.code = 200 and result.data <> invalid
if result.data.isEnabled = true
' Enable features
end if
end if

This returns a data message containing the package info. Check isEnabled to determine user consent.

m.spEngine.payload = { scene: m.top.GetScene(), applicationId: "YOUR_APPLICATION_ID" }
m.spEngine.action = "showBanner"

This banner informs users about data collection and provides options to accept, deny, or customize consent.

Users can customize their preferences via the Preference Center:

m.spEngine.payload = { scene: m.top.GetScene(), applicationId: "YOUR_APPLICATION_ID" }
m.spEngine.action = "showPreferenceCenter"

You can mark certain services as essential. These cannot be disabled by users.

The Preferences screen includes a tab showcasing content related to the app’s privacy policy.

Users can submit data requests via the Request Data section.