The Roku SDK supports programmatic experimentation (Dynamic Variables and Code Blocks) as well as Feature Flags.
SDK Installation and Initialization¶
- Download the latest Roku SDK from the SDK Download page.
- Drag the files into your project.
- Add the following snippet to the XML file of the main screen component using the API Token associated with your app, which can be found in the Install tab of your Dashboard. Note this is different than the App Key used for other platforms.
<Apptimize id="apptimize" apiToken="<APIToken>" appName="<AppName>" appVersion="<AppVersion>" logLevel="<VERBOSE|DEBUG|INFO|WARN|ERROR|NONE>" />
- Add the following snippet to the BrightScript file of the main screen component.
m.apptimize = m.top.findNode("Apptimize") m.apptimize.observeField("content", "setcontent") //handles the results of each request function setcontent(message as Object) apptimizeResponse = message.getData() ?apptimizeResponse.id 'id returned by each api request ?apptimizeResponse.success ?apptimizeResponse.response 'data returned by the request end function
- You should now have access to all Apptimize APIs.