initSession
Method | Description |
---|---|
| Initializes your Branch session. |
Argument | Type | Description |
---|---|---|
|
| Input arguments. Typically |
|
| Name of the callback function for initialization. |
Example Usage
sub init()
' Other init Configs...'
' BRANCH SDK INTEGRATION - Create Instance'
m.branchSdkObj = CreateBranchSdkForSceneGraphApp()
if (m.branchSdkObj = invalid) then
ShowMessageDialog("Failed to initialize Branch SDK!")
else
' BRANCH SDK INTEGRATION - Initialize Branch'
m.branchSdkObj.initSession(m.global.launchArgs, "OnInitSessionCallbackFunc")
end if
' Other init Configs...'
end sub
function OnInitSessionCallbackFunc(event as object) as void
data = event.GetData()
print "OnInitSessionCallbackFunc: " data
if (data <> invalid) then
m.lSessionApiResultDetails.text = FormatJson(data)
else
m.lSessionApiResultDetails.text = "initSession API response received!"
end if
message = "API Succeeded!"
if (data.error <> invalid)
message = "API Error!"
else
ShowMessageDialog("initSession" + " " + message)
end if
end function
setPreinstallData
Method | Description |
---|---|
setPreinstallData: function(campaign = "", partner = "") as void | If your app is preinstalled on Roku devices, for builds distributed to Roku, use this method to set configuration settings for your Branch session to attribute the pre-install to a specific partner. |
Argument | Type | Description |
---|---|---|
|
| Name of the campaign. |
|
| Name of the partner. This will typically be a |
sub init()
' BRANCH SDK INTEGRATION - Create Instance'
m.branchSdkObj = CreateBranchSdkForSceneGraphApp()
if (m.branchSdkObj = invalid) then
ShowMessageDialog("Failed to initialize Branch SDK!")
else
print "MainScene : setPreinstallData"
' BRANCH SDK INTEGRATION - Call API'
m.branchSdkObj.setPreinstallData("MyCampaign", "MyPartner")
InitSession_Clicked()
end if
end sub
handleInput
Method | Description |
---|---|
| Handles an input to retrieve deep linking data |
Argument | Type | Description |
---|---|---|
|
| Input arguments. Typically |
|
| Name of the callback function for initialization. |
Example Usage
sub HandleInput_Clicked()
if (m.branchSdkObj = invalid) then
ShowMessageDialog("Branch SDK is not initialized!")
return
end if
print "Calling Branch HandleInput API"
print "m.global.launchArgs : " m.global.launchArgs
if (m.global.launchArgs <> invalid) then
' BRANCH SDK INTEGRATION - Call API'
m.branchSdkObj.handleInput(m.global.launchArgs, "OnHandleInputCallbackFunc")
else
ShowMessageDialog("Please provide deepLinking arguments!")
end if
end sub
function OnHandleInputCallbackFunc(event as object) as void
data = event.GetData()
print "OnHandleInputCallbackFunc: " data
m.global.launchArgs = invalid
message = "API Succeeded!"
if (data.error <> invalid)
message = "API Error!"
end if
ShowMessageDialog("handleInput" + " " + message)
end function
logEvent
Method | Description |
---|---|
Tracks an event or conversion like PURCHASE or VIEW_STREAM. |
Argument | Type | Description |
---|---|---|
|
| Name of the event. List of compatible events can be found here. |
|
| The alias of your event. |
|
| The ID of of your event. |
|
| The currency value of your event. List of compatible events can be found here. |
|
| The revenue of your event. |
|
| Name of the callback function for your event. |
Example Usage
sub LogEventPurchase_Clicked()
if (m.branchSdkObj = invalid) then
ShowMessageDialog("Branch SDK is not initialized!")
return
end if
print "Calling Branch LogEvent Standard API"
' BRANCH SDK INTEGRATION - Call API'
m.branchSdkObj.logEvent(BranchSdkConstants().EVENT_TYPE.PURCHASE, "My First Purchase as customer_event_alias", "transaction_id", "INR", 99.99, "OnLogEventPurchaseCallbackFunc")
end sub
function OnLogEventPurchaseCallbackFunc(event as object) as void
data = event.GetData()
print "OnLogEventPurchaseCallbackFunc: " data
message = "API Succeeded!"
if (data.error <> invalid)
message = "API Error!"
end if
ShowMessageDialog("logEvent Purchase" + " " + message)
end function
disableTracking
Method | Description |
---|---|
If you need to comply with a user's request to not be tracked for GDPR purposes, or otherwise determine that a user should not be tracked, utilize this field to prevent Branch from sending network requests. |
Argument | Type | Description |
---|---|---|
|
| Set to |
Example Usage
sub init()
m.bTracking.observeField("buttonSelected", "Tracking_Clicked")
' m.bInitSession.setFocus(true)'
m.bSetIdentity.setFocus(true)
' BRANCH SDK INTEGRATION - Create Instance'
m.branchSdkObj = CreateBranchSdkForSceneGraphApp()
end sub
sub Tracking_Clicked()
if (m.branchSdkObj = invalid) then
ShowMessageDialog("Branch SDK is not initialized!")
return
end if
print "Calling Branch Tracking API"
' BRANCH SDK INTEGRATION - Call API'
m.branchSdkObj.disableTracking(m.IsTracking)
m.IsTracking = not m.IsTracking
SetTrackingButtonText()
end sub
setIdentity
Method | Description |
---|---|
setIdentity: function(developer_identity = "", callbackFunc = "") as void | Sets the identity of the user. Typically performed when the user logs in. |
Argument | Type | Description |
---|---|---|
|
| The ID of the user logging in. |
|
| Name of the callback function for setting identity. |
Example Usage
sub init()
m.bSetIdentity.observeField("buttonSelected", "SetIdentity_Clicked")
' m.bInitSession.setFocus(true)'
m.bSetIdentity.setFocus(true)
' BRANCH SDK INTEGRATION - Create Instance'
m.branchSdkObj = CreateBranchSdkForSceneGraphApp()
SetTrackingButtonText()
end sub
sub SetIdentity_Clicked()
if (m.branchSdkObj = invalid) then
ShowMessageDialog("Branch SDK is not initialized!")
return
end if
print "Calling Branch SetIdentity API"
' BRANCH SDK INTEGRATION - Call API'
m.branchSdkObj.setIdentity("User123", "OnSetIdentityCallbackFunc")
end sub
logout
Method | Description |
---|---|
Removes the identity set from |
Argument | Type | Description |
---|---|---|
|
| Name of the callback function for removing identity. |
Example Usage
sub init()
m.bLogout.observeField("buttonSelected", "Logout_Clicked")
' m.bInitSession.setFocus(true)'
m.bSetIdentity.setFocus(true)
' BRANCH SDK INTEGRATION - Create Instance'
m.branchSdkObj = CreateBranchSdkForSceneGraphApp()
SetTrackingButtonText()
end sub
sub Logout_Clicked()
if (m.branchSdkObj = invalid) then
ShowMessageDialog("Branch SDK is not initialized!")
return
end if
print "Calling Branch Logout API"
' BRANCH SDK INTEGRATION - Call API'
m.branchSdkObj.logout("OnLogoutCallbackFunc")
end sub