Last modified June 30, 2020 by Shelly Wolfe

Roku SDK upgrade guide

This guide provides information about how you can upgrade to the latest Swrve Roku SDK. For information about the changes that have been made in each Roku SDK release, see Roku SDK release notes.

Version 4.0.1

There are no code changes required to upgrade to Swrve Roku SDK v4.0.1.


Version 4.0

This section provides information to enable you to upgrade to Swrve Roku SDK v4.0.

Date-typed user properties

SwrveUserUpdateWithDate now uses an ISO string to pass the date and time, so update any date-typed user properties to send all date-time parameters in ISO format. For more information, see the Roku integration guide.


Version 3.0

This section provides information to enable you to upgrade to Swrve Roku SDK v3.0.

Summary

We’ve redesigned the setup and architecture of the Roku SDK for easier configuration and improved performance. The main changes are:

  • Replaced GetSwrveClientInstance() with SwrveSDK(),which is now the primary interaction file for Swrve’s public APIs.
  • Moved setup of Swrve client, listener, and config from the Main loop to a new file called SwrveNode.
  • Removed SwrveBaseScene and SwrveBaseGroup and the requirement to extend component Scenes and Groups. You must now add the SwrveNode reference as the last component in your main scene.

For detailed changes see the following table and the Roku integration guide.

Remove Summary
Setup of swrveConfig from Main.brs swrveConfig setup is now in the SwrveNode file
port = CreateObject("roMessagePort")
swrveClient = Swrve(swrveConfig, port)

from Main.brs
To start the Swrve client, add
SwrveNode = m.top.findNode("SwrveNodeId")
SwrveNode.startSwrve = true

to your main scene brs
swrveListener and swrveClient from Main.brs while loop:
In Main.brs, add
Scene or Group extensions, for example SwrveBaseScene and SwrveBaseGroup.

Scenes<component name="YourSceneName" extends="SwrveBaseScene">

Groups<component name="YourGroupName" extends="SwrveBaseGroup">

In your Main Scene XML file,  add script components for:

Add the SwrveNode as the last child:

<SwrveNode id = “SwrveNodeId”/>

In your existing Scene graph components, add script components for:

CHANGED TO
GetSwrveClientInstance() SwrveSDK

Use directly or create an instance of it as follows:

m.swrveSDK = SwrveSDK()

SwrveEvent(instance as Object, eventName as String, payload as Object) SwrveEvent(eventName as String, payload as Object)
SwrveUserUpdate(instance as Object, attributes as Object) SwrveUserUpdate(attributes as Object)
SwrvePurchaseEvent(instance as Object, quantity as Integer, itemName as String, cost as Float, currency as String) SwrvePurchaseEvent(quantity as Integer, itemName as String, cost as Float, currency as String)
SwrveIAPWithoutReceipt(instance as Object, product as Object, rewards as Object, localCurrency as String, store as String) SwrveIAPWithoutReceipt(product as Object, rewards as Object, localCurrency as String)
setCustomCallback(context, functionName as String) SwrveSetCustomCallback(callback as String)
setNewResourcesCallback(context, functionName as String) SwrveSetNewResourcesCallback(functionName as String)

For more information, see the Roku integration guide.


Version 2.0.1

There are no code changes required to upgrade to Swrve Roku SDK v2.0.1.


Version 2.0

This section provides information to enable you to upgrade to Swrve Roku SDK v2.0.

User identity

  • The UserId config property has now been deprecated. If you want to manage users specifically, you must now use the new User Identity APIs. For more information, see the Roku integration guide.

Version 1.1

There are no code changes required to upgrade to Swrve Roku SDK v1.1.