Initialize the SDK
Overview
-
In Visual Studio, open the main.brs file from the source folder.
-
In the main.brs file, you'll see the 'client-application' scene as the first screen that is created and shown.
-
Open the scene.brs and create the OTinitialize node in the init() as m.global.OTsdk = CreateObject(“roSGNode”,”OTinitialize”)
- The OTinitialize id is the name of the component that is specified in OTinitialize.xml, which contains all the interfaces and their public methods as part of the SDK's controller component(s).
- Once we create the OTsdk init(), the sdkParams values such as appId, location, language and version need to be set and call the public method initOTSDKData() in the OTinitialize.brs file. The declaration also prompts the SDK data download.
-
Once it is downloaded, it will be set inside the m.global.Addfield as "_OT_initialize_data".
-
You'll have access to all the setupUI public methods through m.global.OTsdk.callFunc("setupUI"), {"view":m.top}) for this given scene.
-
If you want to have access to this public method across all scenes in the application, you'll need to introduce and declare the OTsdk in a global method: m.global.OTsdk = m.top.FindNode("OTsdk").
-
By doing this global declaration, you won't need to declare another scene.
-
This is also true if you want to set up global methods for each of the calls in the scene.brs file, to create global methods for all scenes.
-
If you choose to call showBannerUI or showPrefereneCenterUI, then you will not have to call setupUI, "view", "type".
Updated 7 months ago