Nonstop Brightscript SDK
Initialization
Initialize the Nonstop SDK after your Main Scene has been created but before doing anything else in your app.
Initialization
The Nonstop SDK takes the form of a Node with is attached to the global object which you can then call functions on to perform certain actions. To initialize the SDK, create an instance of this node and then set the following fields:
environment- this should be set to eitherdev,staging,qaorproductiondepending on the build of the appfontsDir- this should be a path to the directory containing the required fonts for the SDK in your app. The current font stack contains Avenir and Futura.amplitudeConfig- provides configuration for the Amplitude tracking the SDK performs internally. Please see the docs on Amplitude for more information.
Then call the Initialize function on the Nonstop node.
Example
main.brs:
sub main()
? "[main] showMainScreen"
m.port = CreateObject("roMessagePort")
m.screen = CreateObject("roSGScreen")
m.screen.setMessagePort(m.port)
m.scene = m.screen.CreateScene("MainScene")
m.screen.Show()
m.global = m.screen.getGlobalNode()
m.scene.callFunc("startApplication", {})
while(true)
msg = wait(0, m.port)
if not processMessage(msg) then exit while
end while
if screen <> invalid then
screen.Close()
screen = invalid
end if
end sub
MainScene.brs:
function startApplication(params as Object)
? "[MainScene] startApplication"
nonstop = m.top.createChild("Nonstop")
nonstop.environment = "dev"
nonstop.fontsDir = "pkg:/fonts/"
amplitudeConfig = createObject("roSGNode", "amplitudeConfig")
amplitudeConfig.setField("apiKey", "357ab438c26e31f044db2aab0da4d3c9")
amplitudeConfig.setField("session_id", 0)
amplitudeConfig.setField("device_id", "device_id_set")
nonstop.amplitudeConfig = amplitudeConfig
nonstop.callFunc("Initalize")
end function
Environments
The Environments parameter controls which APIs the SDK will hit, and thus which Nonstop Admin and ShowMS Environment is tied to them. Developers should be conscious of this and match their Nonstop Environment to their ShowMS environment for the given build.
- Dev
- Admin - https://dev.admin.nonstopapp.co/
- Client API - https://dev.api.nonstopapp.co/swagger/index.html
- ShowMS Web - http://dev.showms.freeform.go.com/
- ShowMS Admin - http://dev.admin.freeform.showms.com/
- ShowMS API - https://dev.api.showms.com/swagger/ui/index
- Staging
- Admin - https://staging.admin.nonstopapp.co/
- Client API - https://staging.api.nonstopapp.co/swagger/index.html
- ShowMS Web - http://staging.showms.freeform.go.com/
- ShowMS Admin - http://staging.admin.freeform.showms.com/
- ShowMS API - https://staging.api.showms.com/swagger/ui/index
- QA
- Admin - https://qa.admin.nonstopapp.co/
- Client API - https://qa.api.nonstopapp.co/swagger/index.html
- ShowMS Web - http://qa.showms.freeform.go.com/
- ShowMS Admin - http://qa.admin.freeform.showms.com/
- ShowMS API - https://qa.api.showms.com/swagger/ui/index
- Production
- Admin - https://admin.nonstopapp.co/
- Client API - https://api.nonstopapp.co/swagger/index.html
- ShowMS Web - http://freeform.go.com/
- ShowMS Admin - http://admin.showms.com/
- ShowMS API - https://api.showms.com/swagger/ui/index
Reward Animations
Note: The Nonstop SDK will asynchronously preload reward animations on initialize for improved performance when they are required so you may see this network call on app start.