Roku SDK upgrade guide
Version 5.0.1
There are no code changes required to upgrade to Swrve Roku SDK v5.0.1.
Version 5.0.0
This section provides information to enable you to upgrade to Swrve Roku SDK v5.0.0.
Summary
The main changes are:
- Remove requirement to call
SwrveSetupGlobals()
in Main.brs. - Removed SwrveObject.brs file.
For detailed changes see the following table and the Roku integration guide.
REMOVE | SUMMARY |
---|---|
SwrveSetupGlobals() function from SwrveClient.brs |
Global fields are name spaced and setup internally through SwrveNode |
SwrveClickEvent(message as Object, buttonName as String) function from SwrveSDK.brs |
This is an internal function |
SwrveImpressionEvent(message as Object) function from SwrveSDK.brs |
This is an internal function |
SwrveObject.brs file | This file has been removed, with some replacement functions added to SwrveUtils.brs |
CHANGED | TO |
SwrveFlushAndClean(product as Object, rewards as Object, currency as String) |
SwrveFlushAndClean() |
Version 4.0.1
There are no code changes required to upgrade to Swrve Roku SDK v4.0.1.
Version 4.0.0
This section provides information to enable you to upgrade to Swrve Roku SDK v4.0.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.0
This section provides information to enable you to upgrade to Swrve Roku SDK v3.0.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()
withSwrveSDK()
,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
andSwrveBaseGroup
and the requirement to extend component Scenes and Groups. You must now add theSwrveNode
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") from Main.brs |
To start the Swrve client, addSwrveNode = m.top.findNode("SwrveNodeId") to your main scene brs |
swrveListener and swrveClient from Main.brs while loop:
while true msg = wait(250, port) swrveClient = GetSwrveClientInstance() if swrveClient <> invalid swrveListener(swrveClient, msg) end if end while |
In Main.brs, add
m.global = screen.getGlobalNode() m.global.id = "GlobalNode" SwrveSetUpGlobals() |
Scene or Group extensions, for example SwrveBaseScene and SwrveBaseGroup.
Scenes – Groups – |
In your Main Scene XML file, add script components for:
SwrveSDK/SwrveSDK.brs SwrveSDK/SwrveResourceManager.brs SwrveSDK/SwrveUtils.brs SwrveSDK/SwrveConstants.brs SwrveSDKSwrveStorageManager.brs SwrveSDK/SwrveProduct.brs Add the SwrveNode as the last child:
In your existing Scene graph components, add script components for: SwrveSDK/SwrveSDK.brs SwrveSDK/SwrveResourceManager.brs SwrveSDK/SwrveUtils.brs |
CHANGED | TO |
GetSwrveClientInstance() |
SwrveSDK
Use directly or create an instance of it as follows:
|
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.
Previous versions
If you’re upgrading from a version older than 3.0.0, please refer to the Roku integration guide.