Skip to content

Roku SDK: Setup & Initialisation

The Secure Privacy Consent Management SDK provides Roku TV developers with an easy way to manage user consent within their channels. By integrating this SDK, you can ensure compliance with privacy regulations while offering users control over their data preferences.

To use the Secure Privacy Consent Management SDK, you need an Application ID. If you don’t have an account yet, sign up for a free trial at Secure Privacy.

To find your Application ID, sign in to the Secure Privacy Platform, go to TV apps, and open your app. The Installation tab shows it under Your Application ID, ready to copy.

The SDK requires Roku OS 10.0 or later and works in SceneGraph channels. It needs nothing in your channel’s manifest beyond the SceneGraph version:

rsg_version=1.2

It needs no extra permissions, bs_libs entries or entitlements.

To begin using the Secure Privacy SDK for Roku, copy the SDK files into your channel. Roku has no package manager, so the SDK is added to your channel’s source tree before packaging.

Latest version: 0.1.5

  1. Download the Secure Privacy Roku SDK and unzip it.
  2. Copy the source/securePrivacy/ directory into your channel’s source/ directory.
  3. Copy the components/securePrivacy/ directory into your channel’s components/ directory.
  4. Copy the sp_* images from images/ into your channel’s images/ directory.

In source/ and components/, the SDK files sit in a securePrivacy subfolder, and every SDK image name starts with sp_, so they will not collide with your channel’s own files. Keep these paths as they are: the SDK loads its own files from these exact locations.

A SHA-256 checksum is published alongside the archive if you want to verify your download.

To initialise the SDK, create the SPConsentEngine node, append it to your scene, and trigger the init action with your applicationId in your main scene or app controller. You may also include secondaryApplicationId, which is an optional parameter used to display a secondary consent banner in your channel:

m.spEngine = CreateObject("roSGNode", "SPConsentEngine")
m.top.AppendChild(m.spEngine)
m.spEngine.ObserveField("initResult", "onSpInitResult")
m.spEngine.payload = {
applicationId: "YOUR_APPLICATION_ID",
secondaryApplicationId: "YOUR_SECONDARY_APPLICATION_ID"
}
m.spEngine.action = "init"

This sets up the SDK and enables access to its features. Initialisation runs in the background, and the result is delivered to the initResult field:

sub onSpInitResult(event as Object)
result = event.GetData()
if result = invalid or not result.DoesExist("code") then return
if result.code = 200
' SDK is ready
else
' Initialisation failed. Check result.msg for the reason
end if
end sub

Add SPConsentEngine to your Scene or to a Group node. If it is added to a plain Node, the consent banner and preference center will not be displayed.

SPConsentEngine is session-bound. If you trigger the clearSession action, re-run the init action before any further SDK calls. See Session Lifecycle & Reinitialisation.

When you configure your Roku app in the Secure Privacy Platform, use a PNG or JPG image for the banner logo, because the SDK does not support SVG.