Package | io.branch.nativeExtensions.branch |
Class | public class Branch |
Inheritance | Branch flash.events.EventDispatcher |
Main interface to the Branch SDK for the Branch native extension.
Property | Defined By | ||
---|---|---|---|
implementation : String [read-only]
The implementation currently in use. | Branch | ||
instance : Branch [static] [read-only] | Branch | ||
isSupported : Boolean [static] [read-only]
Whether the current device supports the extensions functionality
| Branch | ||
nativeVersion : String [read-only]
The native version string of the native extension. | Branch | ||
version : String [read-only]
The version of this extension. | Branch |
Method | Defined By | ||
---|---|---|---|
Branch()
Branch is a Singleton, it should be access through the Branch.instance reference. | Branch | ||
Branch | |||
disableTracking(disabled:Boolean):Boolean
TODO
| Branch | ||
dispose():void
Disposes the extension and releases any allocated resources. | Branch | ||
getCredits(bucket:String):void
Reward balances change randomly on the backend when certain actions are taken (defined by your rules), so it'll make an asynchronous call to retrieve the balance. | Branch | ||
getCreditsHistory(bucket:String):void
This call will retrieve the entire history of credits and redemptions from the individual user. | Branch | ||
getFirstReferringParams():String
If you ever want to access the original session params (the parameters passed in for the first install event only), you can use this line. | Branch | ||
[static] | Branch | ||
getLatestReferringParams():String
These session parameters will be available at any point later on with this command. | Branch | ||
handleDeepLink(link:String, forceNewSession:Boolean = true):void
Allows you to deep link into your own app from your app itself
Warning: Handling a new deep link in your app will clear the current
session data and a new referred "open" will be attributed. | Branch | ||
init(useTestKey:Boolean = false):void Deprecated: Use initSession( options )
Initialise the Branch SDK. | Branch | ||
initSession(options:BranchOptions = null):void
Initialise the Branch SDK and start a session. | Branch | ||
logEvent(event:Object):Boolean
Logs an event to Branch for tracking and analytics
You should use a BranchEventBuilder to construct the parameter for this function. | Branch | ||
logout():void
If you provide a logout function in your app, be sure to clear the user when the logout completes. | Branch | ||
redeemRewards(credits:int, bucket:String):void
We will store how many of the rewards have been deployed so that you don't have to track it on your end. | Branch | ||
setIdentity(userId:String):void
Often, you might have your own user IDs, or want referral and event data to persist across platforms or uninstall/reinstall. | Branch | ||
userCompletedAction(action:String, stateStringifiedJSON:String = {}):void
Register Custom Events
| Branch | ||
validateIntegration():void
This will attempt to validate the current application's Branch integration
and will output results to the device log
This is for testing in development only! Make sure you remove or comment out this line of code in your release versions. | Branch |
Event | Summary | Defined By | ||
---|---|---|---|---|
Dispatched when the getCredits has failed. | Branch | |||
Dispatched when the getCredits method is called and SUCCESS. | Branch | |||
Dispatched when the getCreditsHistory has failed. | Branch | |||
Dispatched when the getCreditsHistory method is called and SUCCESS. | Branch | |||
Dispatched when the getShortUrl has failed. | Branch | |||
Dispatched when the short url has been successfully created. | Branch | |||
Dispatched when the key init has failed. | Branch | |||
Dispatched when the key has been successfully set up. | Branch | |||
Dispatched when the redeemRewards has failed. | Branch | |||
Dispatched when the redeemRewards has SUCCESS. | Branch | |||
Dispatched when the identity set up has failed. | Branch | |||
Dispatched when the identity has been successfully set up. | Branch |
Constant | Defined By | ||
---|---|---|---|
EXT_CONTEXT_ID : String = io.branch.nativeExtensions.Branch [static] | Branch | ||
VERSION : String = 5.4.0 [static] | Branch |
implementation | property |
implementation:String
[read-only]
The implementation currently in use. This should be one of the following depending on the platform in use and the functionality supported by this extension:
Android
iOS
default
unknown
public function get implementation():String
instance | property |
isSupported | property |
isSupported:Boolean
[read-only] Whether the current device supports the extensions functionality
public static function get isSupported():Boolean
nativeVersion | property |
nativeVersion:String
[read-only]
The native version string of the native extension.
public function get nativeVersion():String
version | property |
version:String
[read-only]
The version of this extension.
This should be of the format, MAJOR.MINOR.BUILD
public function get version():String
Branch | () | Constructor |
public function Branch()
Branch
is a Singleton, it should be access through the Branch.instance
reference.
createUniversalObject | () | method |
disableTracking | () | method |
public function disableTracking(disabled:Boolean):Boolean
TODO
Parameters
disabled:Boolean |
Boolean — |
dispose | () | method |
public function dispose():void
Disposes the extension and releases any allocated resources. Once this function has been called, the extension functionality will have to be re-initialised upon next use.
getCredits | () | method |
public function getCredits(bucket:String):void
Reward balances change randomly on the backend when certain actions are taken (defined by your rules), so it'll make an asynchronous call to retrieve the balance.
Be sure to listen GET_CREDITS
event.
Parameters
bucket:String — The bucket to get credits balance from.
|
getCreditsHistory | () | method |
public function getCreditsHistory(bucket:String):void
This call will retrieve the entire history of credits and redemptions from the individual user.
Be sure to listen GET_CREDITS_HISTORY_SUCCESS
and GET_CREDITS_HISTORY_FAILED
events.
Parameters
bucket:String — The bucket to get credits balance from.
|
getFirstReferringParams | () | method |
public function getFirstReferringParams():String
If you ever want to access the original session params (the parameters passed in for the first install event only), you can use this line. This is useful if you only want to reward users who newly installed the app from a referral link or something.
ReturnsString — a String with installParams, turn it into a JSON.
|
getInstance | () | method |
getLatestReferringParams | () | method |
public function getLatestReferringParams():String
These session parameters will be available at any point later on with this command. If no params, the dictionary will be empty. This refreshes with every new session (app installs AND app opens).
ReturnsString — a String with sessionParams, turn it into a JSON.
|
handleDeepLink | () | method |
public function handleDeepLink(link:String, forceNewSession:Boolean = true):void
Allows you to deep link into your own app from your app itself
Warning: Handling a new deep link in your app will clear the current session data and a new referred "open" will be attributed.
Parameters
link:String — The deep link
| |
forceNewSession:Boolean (default = true ) — If true a new session is created
|
init | () | method |
public function init(useTestKey:Boolean = false):void
Initialise the Branch SDK.
Note: You should use initSession( options:BranchOptions )
to get access to the updated Branch features.
Parameters
useTestKey:Boolean (default = false ) — Set it to true to use the key test.
|
initSession | () | method |
public function initSession(options:BranchOptions = null):void
Initialise the Branch SDK and start a session.
You will get the deep linked params associated with the link
that the user clicked before showing up via the
BranchEvent.INIT_SUCCESS
event.
Parameters
options:BranchOptions (default = null )
|
See also
Branch.instance.initSession( new BranchOptions() .setUseTestKey() .setDelayInitToCheckForSearchAds() );
logEvent | () | method |
public function logEvent(event:Object):Boolean
Logs an event to Branch for tracking and analytics
You should use a BranchEventBuilder
to construct the parameter for this function.
Parameters
event:Object — An object representing the Branch event
|
Boolean — true if the event is logged to Branch
|
See also
Branch.instance.logEvent( new BranchEventBuilder( BranchEventBuilder.STANDARD_EVENT_PURCHASE ) .setCurrency( "USD" ) .setRevenue( 1.23 ) .build() );
"your_custom_event"
:
Branch.instance.logEvent( new BranchEventBuilder( "your_custom_event" ) .addCustomDataProperty("your_custom_key", "your_custom_value") .build() );
logout | () | method |
public function logout():void
If you provide a logout function in your app, be sure to clear the user when the logout completes. This will ensure that all the stored parameters get cleared and all events are properly attributed to the right identity. Warning this call will clear the referral credits and attribution on the device.
redeemRewards | () | method |
public function redeemRewards(credits:int, bucket:String):void
We will store how many of the rewards have been deployed so that you don't have to track it on your end. In order to save that you gave the credits to the user, you can call redeem. Redemptions will reduce the balance of outstanding credits permanently.
Parameters
credits:int — credits given to the user.
| |
bucket:String — The bucket to get credits balance from.
|
setIdentity | () | method |
public function setIdentity(userId:String):void
Often, you might have your own user IDs, or want referral and event data to persist across platforms or uninstall/reinstall. It's helpful if you know your users access your service from different devices. This where we introduce the concept of an 'identity'.
Parameters
userId:String — Identify a user, with his user id.
|
userCompletedAction | () | method |
public function userCompletedAction(action:String, stateStringifiedJSON:String = {}):void
Register Custom Events
Parameters
action:String | |
stateStringifiedJSON:String (default = {} ) — Store some state with the event, a stringified JSON.
|
validateIntegration | () | method |
public function validateIntegration():void
This will attempt to validate the current application's Branch integration and will output results to the device log
This is for testing in development only! Make sure you remove or comment out this line of code in your release versions.
getcredits:failed | Event |
io.branch.nativeExtensions.branch.events.BranchCreditsEvent
io.branch.nativeExtensions.branch.events.BranchCreditsEvent.GET_CREDITS_FAILED
Dispatched when the
getCredits
has failed. See event's data
for details.
getcredits:success | Event |
io.branch.nativeExtensions.branch.events.BranchCreditsEvent
io.branch.nativeExtensions.branch.events.BranchCreditsEvent.GET_CREDITS_SUCCESS
Dispatched when the
getCredits
method is called and SUCCESS. See event's data
for details.
getcreditshistory:failed | Event |
io.branch.nativeExtensions.branch.events.BranchCreditsEvent
io.branch.nativeExtensions.branch.events.BranchCreditsEvent.GET_CREDITS_HISTORY_FAILED
Dispatched when the
getCreditsHistory
has failed. See event's data
for details.
getcreditshistory:success | Event |
io.branch.nativeExtensions.branch.events.BranchCreditsEvent
io.branch.nativeExtensions.branch.events.BranchCreditsEvent.GET_CREDITS_HISTORY_SUCCESS
Dispatched when the
getCreditsHistory
method is called and SUCCESS. See event's data
for details.
getshorturl:failed | Event |
io.branch.nativeExtensions.branch.events.BranchEvent
io.branch.nativeExtensions.branch.events.BranchEvent.GET_SHORT_URL_FAILED
Dispatched when the
getShortUrl
has failed. See event's data
for details.
getshorturl:success | Event |
io.branch.nativeExtensions.branch.events.BranchEvent
io.branch.nativeExtensions.branch.events.BranchEvent.GET_SHORT_URL_SUCCESS
Dispatched when the short url has been successfully created. See event's
data
for the result.
init:failed | Event |
io.branch.nativeExtensions.branch.events.BranchEvent
io.branch.nativeExtensions.branch.events.BranchEvent.INIT_FAILED
Dispatched when the key init has failed. See event's
data
for details.
init:success | Event |
io.branch.nativeExtensions.branch.events.BranchEvent
io.branch.nativeExtensions.branch.events.BranchEvent.INIT_SUCCESS
Dispatched when the key has been successfully set up. See event's
data
for referringParams.
redeemrewards:failed | Event |
io.branch.nativeExtensions.branch.events.BranchCreditsEvent
io.branch.nativeExtensions.branch.events.BranchCreditsEvent.REDEEM_REWARDS_FAILED
Dispatched when the
redeemRewards
has failed. See event's data
for details.
redeemrewards:success | Event |
io.branch.nativeExtensions.branch.events.BranchCreditsEvent
io.branch.nativeExtensions.branch.events.BranchCreditsEvent.REDEEM_REWARDS_SUCCESS
Dispatched when the
redeemRewards
has SUCCESS.
setidentity:failed | Event |
io.branch.nativeExtensions.branch.events.BranchEvent
io.branch.nativeExtensions.branch.events.BranchEvent.SET_IDENTITY_FAILED
Dispatched when the identity set up has failed. See event's
data
for details.
setidentity:success | Event |
io.branch.nativeExtensions.branch.events.BranchEvent
io.branch.nativeExtensions.branch.events.BranchEvent.SET_IDENTITY_SUCCESS
Dispatched when the identity has been successfully set up.
EXT_CONTEXT_ID | Constant |
public static const EXT_CONTEXT_ID:String = io.branch.nativeExtensions.Branch
VERSION | Constant |
public static const VERSION:String = 5.4.0