Roku SDK: Setup & Initialisation
Overview
Section titled “Overview”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.
Getting Started
Section titled “Getting Started”Obtain Your Application ID
Section titled “Obtain Your Application ID”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.
Requirements
Section titled “Requirements”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.2It needs no extra permissions, bs_libs entries or entitlements.
Installation
Section titled “Installation”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
- Download the Secure Privacy Roku SDK and unzip it.
- Copy the
source/securePrivacy/directory into your channel’ssource/directory. - Copy the
components/securePrivacy/directory into your channel’scomponents/directory. - Copy the
sp_*images fromimages/into your channel’simages/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.
Initialisation
Section titled “Initialisation”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 ifend subAdd 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.
Asset Configuration Note
Section titled “Asset Configuration Note”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.
