Initialize the SDK

Overview

  1. In Visual Studio, open the main.brs file from the source folder.

  2. In the main.brs file, you'll see the 'client-application' scene as the first screen that is created and shown.

  3. Open the scene.brs and create the OTinitialize node in the init() as m.global.OTsdk = CreateObject(“roSGNode”,”OTinitialize”)

  1. 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).

  1. 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.
  1. Once it is downloaded, it will be set inside the m.global.Addfield as "_OT_initialize_data".

  2. You'll have access to all the setupUI public methods through m.global.OTsdk.callFunc("setupUI"), {"view":m.top}) for this given scene.

  3. 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").

  4. By doing this global declaration, you won't need to declare another scene.

  5. 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.

  6. If you choose to call showBannerUI or showPrefereneCenterUI, then you will not have to call setupUI, "view", "type".