public class Branch
extends java.lang.Object
The core object required when using Branch SDK. You should declare an object of this type at the class-level of each Activity or Fragment that you wish to use Branch functionality within.
Normal instantiation of this object would look like this:
Branch.getInstance(this.getApplicationContext()) // from an Activity Branch.getInstance(getActivity().getApplicationContext()) // from a Fragment
| Modifier and Type | Class and Description |
|---|---|
static interface |
Branch.BranchLinkCreateListener
An Interface class that is implemented by all classes that make use of
Branch.BranchLinkCreateListener, defining a single method that takes a URL
String format, and an error message of BranchError format that will be
returned on failure of the request response. |
static interface |
Branch.BranchListResponseListener
An Interface class that is implemented by all classes that make use of
Branch.BranchListResponseListener, defining a single method that takes a list of
JSONArray format, and an error message of BranchError format that will be
returned on failure of the request response. |
static interface |
Branch.BranchReferralInitListener
An Interface class that is implemented by all classes that make use of
Branch.BranchReferralInitListener, defining a single method that takes a list of params in
JSONObject format, and an error message of BranchError format that will be
returned on failure of the request response. |
static interface |
Branch.BranchReferralStateChangedListener
An Interface class that is implemented by all classes that make use of
Branch.BranchReferralStateChangedListener, defining a single method that takes a value of
Boolean format, and an error message of BranchError format that will be
returned on failure of the request response. |
class |
Branch.BranchWindowCallback |
static class |
Branch.CreditHistoryOrder
enum containing the sort options for return of credit history.
|
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
ALWAYS_DEEPLINK
String value indicating whether the link should always initiate a deep link action. |
static java.lang.String |
DEEPLINK_PATH
String value denoting the deep link path to override Branch's default one. |
static java.lang.String |
FEATURE_TAG_DEAL
Hard-coded
String that denotes a link that is part of a commercial 'deal' or offer. |
static java.lang.String |
FEATURE_TAG_GIFT
Hard-coded
String that denotes a link tagged as a gift action within a service or
product. |
static java.lang.String |
FEATURE_TAG_INVITE
Hard-coded
String that denotes a 'referral' tag; applies to links that are sent as
referral actions by users of an app using an 'invite contacts' feature for instance. |
static java.lang.String |
FEATURE_TAG_REFERRAL
Hard-coded
String that denotes a 'referral' tag; applies to links that are associated
with a referral program, incentivized or not. |
static java.lang.String |
FEATURE_TAG_SHARE
Hard-coded
String that denotes a BranchLinkData.tags; applies to links that
are shared with others directly as a user action, via social media for instance. |
static int |
LINK_TYPE_ONE_TIME_USE
An
Integer value indicating the link type. |
static int |
LINK_TYPE_UNLIMITED_USE
An
Integer value indicating the link type. |
static java.lang.String |
OG_APP_ID
Unique identifier for the app in use.
|
static java.lang.String |
OG_DESC
The description of the object to appear in social media feeds that use
Facebook's Open Graph specification.
|
static java.lang.String |
OG_IMAGE_URL
An image URL which should represent your object to appear in social media feeds that use
Facebook's Open Graph specification.
|
static java.lang.String |
OG_TITLE
Open Graph: The title of your object as it should appear within the graph, e.g., "The Rock".
|
static java.lang.String |
OG_URL
The canonical URL of your object that will be used as its permanent ID in the graph.
|
static java.lang.String |
OG_VIDEO
A URL to a video file that complements this object.
|
static java.lang.String |
REDEEM_CODE
The code to be passed as part of a deal or gift; retrieved from the Branch object as a
tag upon initialisation.
|
static java.lang.String |
REDIRECT_ANDROID_URL
The redirect URL provided when the link is handled by an Android device.
|
static java.lang.String |
REDIRECT_BLACKBERRY_URL
The redirect URL provided when the link is handled by a Blackberry device.
|
static java.lang.String |
REDIRECT_DESKTOP_URL
The redirect URL provided when the link is handled by a desktop client.
|
static java.lang.String |
REDIRECT_FIRE_URL
The redirect URL provided when the link is handled by an Amazon Fire device.
|
static java.lang.String |
REDIRECT_IOS_URL
The redirect URL provided when the link is handled by an iOS device.
|
static java.lang.String |
REDIRECT_IPAD_URL
The redirect URL provided when the link is handled by a large form-factor iOS device such as
an iPad.
|
static java.lang.String |
REDIRECT_WINDOWS_PHONE_URL
The redirect URL provided when the link is handled by a Windows Phone device.
|
static java.lang.String |
REFERRAL_BUCKET_DEFAULT
Default value of referral bucket; referral buckets contain credits that are used when users
are referred to your apps.
|
static java.lang.String |
REFERRAL_CODE
Key value for referral code as a parameter.
|
static int |
REFERRAL_CODE_AWARD_UNIQUE
An
Integer value indicating the calculation type of the referral code. |
static int |
REFERRAL_CODE_AWARD_UNLIMITED
An
Integer value indicating the calculation type of the referral code. |
static int |
REFERRAL_CODE_LOCATION_BOTH
An
Integer value indicating the user to reward for applying a referral code. |
static int |
REFERRAL_CODE_LOCATION_REFERREE
An
Integer value indicating the user to reward for applying a referral code. |
static int |
REFERRAL_CODE_LOCATION_REFERRING_USER
An
Integer value indicating the user to reward for applying a referral code. |
static java.lang.String |
REFERRAL_CODE_TYPE
Hard-coded value for referral code type.
|
static int |
REFERRAL_CREATION_SOURCE_SDK
Branch SDK version for the current release of the Branch SDK.
|
| Modifier and Type | Method and Description |
|---|---|
void |
applyReferralCode(java.lang.String code,
Branch.BranchReferralInitListener callback)
Applies a supplied referral code to the current user session upon initialisation.
|
void |
closeSession()
Closes the current session, dependent on the state of the
PrefHelper.getSmartSession() Boolean value. |
void |
disableAppList()
Calls the
PrefHelper.disableExternAppListing() on the local instance to prevent
a list of installed apps from being returned to the Branch API. |
void |
disableSmartSession()
If there's further Branch API call happening within the two seconds, we then don't close
the session; otherwise, we close the session after two seconds.
|
void |
disableTouchDebugging()
Calls the
PrefHelper.disableTouchDebugging() ()} on the local instance to prevent
touch debugging feature. |
static Branch |
getAutoInstance(android.content.Context context)
Singleton method to return the pre-initialised, or newly initialise and return, a singleton
object of the type
Branch. |
static Branch |
getAutoTestInstance(android.content.Context context)
If you configured the your Strings file according to the guide, you'll be able to use
the test version of your app by just calling this static method before calling initSession.
|
void |
getContentUrl(java.util.Collection<java.lang.String> tags,
java.lang.String channel,
org.json.JSONObject params,
Branch.BranchLinkCreateListener callback)
Configures and requests a content URL (defined as feature = sharing) to be generated by the Branch servers.
|
void |
getContentUrl(java.lang.String channel,
org.json.JSONObject params,
Branch.BranchLinkCreateListener callback)
Configures and requests a content URL (defined as feature = sharing) to be generated by the Branch servers.
|
java.lang.String |
getContentUrlSync(java.util.Collection<java.lang.String> tags,
java.lang.String channel,
org.json.JSONObject params)
Configures and requests a content URL (defined as feature = sharing) to be generated by the Branch servers, via a synchronous
call
|
java.lang.String |
getContentUrlSync(java.lang.String channel,
org.json.JSONObject params)
Configures and requests a content URL (defined as feature = sharing) to be generated by the Branch servers, via a synchronous
call
|
void |
getCreditHistory(Branch.BranchListResponseListener callback)
Gets the credit history of the specified bucket and triggers a callback to handle the
response.
|
void |
getCreditHistory(java.lang.String bucket,
Branch.BranchListResponseListener callback)
Gets the credit history of the specified bucket and triggers a callback to handle the
response.
|
void |
getCreditHistory(java.lang.String afterId,
int length,
Branch.CreditHistoryOrder order,
Branch.BranchListResponseListener callback)
Gets the credit history of the specified bucket and triggers a callback to handle the
response.
|
void |
getCreditHistory(java.lang.String bucket,
java.lang.String afterId,
int length,
Branch.CreditHistoryOrder order,
Branch.BranchListResponseListener callback)
Gets the credit history of the specified bucket and triggers a callback to handle the
response.
|
int |
getCredits()
Retrieve the number of credits available for the "default" bucket.
|
int |
getCreditsForBucket(java.lang.String bucket)
Returns an
Integer of the number of credits available for use within the supplied
bucket name. |
org.json.JSONObject |
getFirstReferringParams()
Returns the parameters associated with the link that referred the user.
|
static Branch |
getInstance()
Singleton method to return the pre-initialised object of the type
Branch. |
static Branch |
getInstance(android.content.Context context)
Singleton method to return the pre-initialised, or newly initialise and return, a singleton
object of the type
Branch. |
static Branch |
getInstance(android.content.Context context,
java.lang.String branchKey)
Singleton method to return the pre-initialised, or newly initialise and return, a singleton
object of the type
Branch. |
org.json.JSONObject |
getLatestReferringParams()
Returns the parameters associated with the link that referred the session.
|
void |
getReferralCode(Branch.BranchReferralInitListener callback)
Configures and requests a referral code to be generated by the Branch servers.
|
void |
getReferralCode(int amount,
Branch.BranchReferralInitListener callback)
Configures and requests a referral code to be generated by the Branch servers.
|
void |
getReferralCode(int amount,
java.util.Date expiration,
Branch.BranchReferralInitListener callback)
Configures and requests a referral code to be generated by the Branch servers.
|
void |
getReferralCode(java.lang.String prefix,
int amount,
Branch.BranchReferralInitListener callback)
Configures and requests a referral code to be generated by the Branch servers.
|
void |
getReferralCode(java.lang.String prefix,
int amount,
java.util.Date expiration,
Branch.BranchReferralInitListener callback)
Configures and requests a referral code to be generated by the Branch servers.
|
void |
getReferralCode(java.lang.String prefix,
int amount,
java.util.Date expiration,
java.lang.String bucket,
int calculationType,
int location,
Branch.BranchReferralInitListener callback)
Configures and requests a referral code to be generated by the Branch servers.
|
void |
getReferralCode(java.lang.String prefix,
int amount,
int calculationType,
int location,
Branch.BranchReferralInitListener callback)
Configures and requests a referral code to be generated by the Branch servers.
|
void |
getReferralUrl(java.util.Collection<java.lang.String> tags,
java.lang.String channel,
org.json.JSONObject params,
Branch.BranchLinkCreateListener callback)
Configures and requests a referral URL (feature = referral) to be generated by the Branch servers.
|
void |
getReferralUrl(java.lang.String channel,
org.json.JSONObject params,
Branch.BranchLinkCreateListener callback)
Configures and requests a referral URL (feature = referral) to be generated by the Branch servers.
|
java.lang.String |
getReferralUrlSync(java.util.Collection<java.lang.String> tags,
java.lang.String channel,
org.json.JSONObject params)
Configures and requests a referral URL to be generated by the Branch servers, via a synchronous
call; with a duration specified within which an app session should be matched to the link.
|
java.lang.String |
getReferralUrlSync(java.lang.String channel,
org.json.JSONObject params)
Configures and requests a referral URL to be generated by the Branch servers, via a synchronous
call; with a duration specified within which an app session should be matched to the link.
|
void |
getShortUrl(Branch.BranchLinkCreateListener callback)
Configures and requests a short URL to be generated by the Branch servers.
|
void |
getShortUrl(java.util.Collection<java.lang.String> tags,
java.lang.String channel,
java.lang.String feature,
java.lang.String stage,
org.json.JSONObject params,
Branch.BranchLinkCreateListener callback)
Configures and requests a short URL to be generated by the Branch servers.
|
void |
getShortUrl(java.util.Collection<java.lang.String> tags,
java.lang.String channel,
java.lang.String feature,
java.lang.String stage,
org.json.JSONObject params,
int duration,
Branch.BranchLinkCreateListener callback)
Configures and requests a short URL to be generated by the Branch servers.
|
void |
getShortUrl(int type,
java.util.Collection<java.lang.String> tags,
java.lang.String channel,
java.lang.String feature,
java.lang.String stage,
org.json.JSONObject params,
Branch.BranchLinkCreateListener callback)
Configures and requests a short URL to be generated by the Branch servers.
|
void |
getShortUrl(int type,
java.lang.String channel,
java.lang.String feature,
java.lang.String stage,
org.json.JSONObject params,
Branch.BranchLinkCreateListener callback)
Configures and requests a short URL to be generated by the Branch servers.
|
void |
getShortUrl(org.json.JSONObject params,
Branch.BranchLinkCreateListener callback)
Configures and requests a short URL to be generated by the Branch servers.
|
void |
getShortUrl(java.lang.String alias,
java.util.Collection<java.lang.String> tags,
java.lang.String channel,
java.lang.String feature,
java.lang.String stage,
org.json.JSONObject params,
Branch.BranchLinkCreateListener callback)
Configures and requests a short URL to be generated by the Branch servers.
|
void |
getShortUrl(java.lang.String channel,
java.lang.String feature,
java.lang.String stage,
org.json.JSONObject params,
Branch.BranchLinkCreateListener callback)
Configures and requests a short URL to be generated by the Branch servers.
|
void |
getShortUrl(java.lang.String channel,
java.lang.String feature,
java.lang.String stage,
org.json.JSONObject params,
int duration,
Branch.BranchLinkCreateListener callback)
Configures and requests a short URL to be generated by the Branch servers.
|
void |
getShortUrl(java.lang.String alias,
java.lang.String channel,
java.lang.String feature,
java.lang.String stage,
org.json.JSONObject params,
Branch.BranchLinkCreateListener callback)
Configures and requests a short URL to be generated by the Branch servers.
|
java.lang.String |
getShortUrlSync()
Configures and requests a short URL to be generated by the Branch servers, via a synchronous
call; with a duration specified within which an app session should be matched to the link.
|
java.lang.String |
getShortUrlSync(java.util.Collection<java.lang.String> tags,
java.lang.String channel,
java.lang.String feature,
java.lang.String stage,
org.json.JSONObject params)
Configures and requests a short URL to be generated by the Branch servers, via a synchronous
call; with a duration specified within which an app session should be matched to the link.
|
java.lang.String |
getShortUrlSync(java.util.Collection<java.lang.String> tags,
java.lang.String channel,
java.lang.String feature,
java.lang.String stage,
org.json.JSONObject params,
int duration)
Configures and requests a short URL to be generated by the Branch servers, via a synchronous
call; with a duration specified within which an app session should be matched to the link.
|
java.lang.String |
getShortUrlSync(int type,
java.util.Collection<java.lang.String> tags,
java.lang.String channel,
java.lang.String feature,
java.lang.String stage,
org.json.JSONObject params)
Configures and requests a short URL to be generated by the Branch servers, via a synchronous
call; with a duration specified within which an app session should be matched to the link.
|
java.lang.String |
getShortUrlSync(int type,
java.lang.String channel,
java.lang.String feature,
java.lang.String stage,
org.json.JSONObject params)
Configures and requests a short URL to be generated by the Branch servers, via a synchronous
call; with a duration specified within which an app session should be matched to the link.
|
java.lang.String |
getShortUrlSync(org.json.JSONObject params)
Configures and requests a short URL to be generated by the Branch servers, via a synchronous
call; with a duration specified within which an app session should be matched to the link.
|
java.lang.String |
getShortUrlSync(java.lang.String alias,
java.util.Collection<java.lang.String> tags,
java.lang.String channel,
java.lang.String feature,
java.lang.String stage,
org.json.JSONObject params)
Configures and requests a short URL to be generated by the Branch servers, via a synchronous
call; with a duration specified within which an app session should be matched to the link.
|
java.lang.String |
getShortUrlSync(java.lang.String channel,
java.lang.String feature,
java.lang.String stage,
org.json.JSONObject params)
Configures and requests a short URL to be generated by the Branch servers, via a synchronous
call; with a duration specified within which an app session should be matched to the link.
|
java.lang.String |
getShortUrlSync(java.lang.String channel,
java.lang.String feature,
java.lang.String stage,
org.json.JSONObject params,
int duration)
Configures and requests a short URL to be generated by the Branch servers, via a synchronous
call; with a duration specified within which an app session should be matched to the link.
|
java.lang.String |
getShortUrlSync(java.lang.String alias,
java.lang.String channel,
java.lang.String feature,
java.lang.String stage,
org.json.JSONObject params)
Configures and requests a short URL to be generated by the Branch servers, via a synchronous
call; with a duration specified within which an app session should be matched to the link.
|
static Branch |
getTestInstance(android.content.Context context)
If you configured the your Strings file according to the guide, you'll be able to use
the test version of your app by just calling this static method before calling initSession.
|
int |
getTotalCountsForAction(java.lang.String action)
Gets the total number of times that the specified action has been carried out.
|
int |
getUniqueCountsForAction(java.lang.String action)
Gets the number of unique times that the specified action has been carried out.
|
boolean |
initSession()
Initialises a session with the Branch API, without a callback or
Activity. |
boolean |
initSession(android.app.Activity activity)
Initialises a session with the Branch API, without a callback or
Activity. |
boolean |
initSession(boolean isReferrable)
Initialises a session with the Branch API, specifying whether the initialisation can count
as a referrable action.
|
boolean |
initSession(boolean isReferrable,
android.app.Activity activity)
Initialises a session with the Branch API, specifying whether the initialisation can count
as a referrable action, and supplying the calling
Activity for context. |
boolean |
initSession(Branch.BranchReferralInitListener callback)
Initialises a session with the Branch API, assigning a
Branch.BranchReferralInitListener
to perform an action upon successful initialisation. |
boolean |
initSession(Branch.BranchReferralInitListener callback,
android.app.Activity activity)
Initialises a session with the Branch API, passing the
Activity and assigning a
Branch.BranchReferralInitListener to perform an action upon successful initialisation. |
boolean |
initSession(Branch.BranchReferralInitListener callback,
boolean isReferrable)
Initialises a session with the Branch API.
|
boolean |
initSession(Branch.BranchReferralInitListener callback,
boolean isReferrable,
android.app.Activity activity)
Initialises a session with the Branch API.
|
boolean |
initSession(Branch.BranchReferralInitListener callback,
boolean isReferrable,
android.net.Uri data)
Initialises a session with the Branch API.
|
boolean |
initSession(Branch.BranchReferralInitListener callback,
boolean isReferrable,
android.net.Uri data,
android.app.Activity activity)
Initialises a session with the Branch API.
|
boolean |
initSession(Branch.BranchReferralInitListener callback,
android.net.Uri data)
Initialises a session with the Branch API.
|
boolean |
initSession(Branch.BranchReferralInitListener callback,
android.net.Uri data,
android.app.Activity activity)
Initialises a session with the Branch API.
|
boolean |
initSessionWithData(android.net.Uri data)
Initialises a session with the Branch API, with associated data from the supplied
Uri. |
boolean |
initSessionWithData(android.net.Uri data,
android.app.Activity activity)
Initialises a session with the Branch API, with associated data from the supplied
Uri. |
boolean |
isUserIdentified()
Indicates whether or not this user has a custom identity specified for them.
|
void |
loadActionCounts()
Fire-and-forget retrieval of action count for the current session.
|
void |
loadActionCounts(Branch.BranchReferralStateChangedListener callback)
Gets the total action count, with a callback to perform a predefined
action following successful report of state change.
|
void |
loadRewards()
Fire-and-forget retrieval of rewards for the current session.
|
void |
loadRewards(Branch.BranchReferralStateChangedListener callback)
Retrieves rewards for the current session, with a callback to perform a predefined
action following successful report of state change.
|
void |
logout()
This method should be called if you know that a different person is about to use the app.
|
void |
redeemRewards(int count)
Redeems the specified number of credits from the "default" bucket, if there are sufficient
credits within it.
|
void |
redeemRewards(int count,
Branch.BranchReferralStateChangedListener callback)
Redeems the specified number of credits from the "default" bucket, if there are sufficient
credits within it.
|
void |
redeemRewards(java.lang.String bucket,
int count)
Redeems the specified number of credits from the named bucket, if there are sufficient
credits within it.
|
void |
redeemRewards(java.lang.String bucket,
int count,
Branch.BranchReferralStateChangedListener callback)
Redeems the specified number of credits from the named bucket, if there are sufficient
credits within it.
|
void |
resetUserSession()
Manually sets the
Boolean value, that indicates that the Branch API connection has
been initialised, to false - forcing re-initialisation. |
void |
setDebug()
Sets the library to function in debug mode, enabling logging of all requests.
|
void |
setIdentity(java.lang.String userId)
Identifies the current user to the Branch API by supplying a unique identifier as a
String value. |
void |
setIdentity(java.lang.String userId,
Branch.BranchReferralInitListener callback)
Identifies the current user to the Branch API by supplying a unique identifier as a
String value, with a callback specified to perform a defined action upon successful
response to request. |
void |
setNetworkTimeout(int timeout)
Sets the duration in milliseconds that the system should wait for a response before considering
any Branch API call to have timed out.
|
void |
setRetryCount(int retryCount)
Sets the number of times to re-attempt a timed-out request to the Branch API, before
considering the request to have failed entirely.
|
void |
setRetryInterval(int retryInterval)
Sets the amount of time in milliseconds to wait before re-attempting a timed-out request
to the Branch API.
|
void |
userCompletedAction(java.lang.String action)
A void call to indicate that the user has performed a specific action and for that to be
reported to the Branch API.
|
void |
userCompletedAction(java.lang.String action,
org.json.JSONObject metadata)
A void call to indicate that the user has performed a specific action and for that to be
reported to the Branch API, with additional app-defined meta data to go along with that action.
|
void |
validateReferralCode(java.lang.String code,
Branch.BranchReferralInitListener callback)
Validates the supplied referral code on initialisation without applying it to the current
session.
|
public static final java.lang.String FEATURE_TAG_SHARE
String that denotes a BranchLinkData.tags; applies to links that
are shared with others directly as a user action, via social media for instance.public static final java.lang.String FEATURE_TAG_REFERRAL
String that denotes a 'referral' tag; applies to links that are associated
with a referral program, incentivized or not.public static final java.lang.String FEATURE_TAG_INVITE
String that denotes a 'referral' tag; applies to links that are sent as
referral actions by users of an app using an 'invite contacts' feature for instance.public static final java.lang.String FEATURE_TAG_DEAL
String that denotes a link that is part of a commercial 'deal' or offer.public static final java.lang.String FEATURE_TAG_GIFT
String that denotes a link tagged as a gift action within a service or
product.public static final java.lang.String REDEEM_CODE
String format.public static final java.lang.String REFERRAL_BUCKET_DEFAULT
Default value of referral bucket; referral buckets contain credits that are used when users are referred to your apps. These can be viewed in the Branch dashboard under Referrals.
public static final java.lang.String REFERRAL_CODE_TYPE
Hard-coded value for referral code type. Referral codes will always result on "credit" actions. Even if they are of 0 value.
public static final int REFERRAL_CREATION_SOURCE_SDK
public static final java.lang.String REFERRAL_CODE
public static final java.lang.String REDIRECT_DESKTOP_URL
public static final java.lang.String REDIRECT_ANDROID_URL
public static final java.lang.String REDIRECT_IOS_URL
public static final java.lang.String REDIRECT_IPAD_URL
public static final java.lang.String REDIRECT_FIRE_URL
public static final java.lang.String REDIRECT_BLACKBERRY_URL
public static final java.lang.String REDIRECT_WINDOWS_PHONE_URL
public static final java.lang.String OG_TITLE
public static final java.lang.String OG_DESC
public static final java.lang.String OG_IMAGE_URL
public static final java.lang.String OG_VIDEO
public static final java.lang.String OG_URL
public static final java.lang.String OG_APP_ID
public static final java.lang.String DEEPLINK_PATH
String value denoting the deep link path to override Branch's default one. By
default, Branch will use yourapp://open?link_click_id=12345. If you specify this key/value,
Branch will use yourapp://'$deeplink_path'?link_click_id=12345public static final java.lang.String ALWAYS_DEEPLINK
String value indicating whether the link should always initiate a deep link action.
By default, unless overridden on the dashboard, Branch will only open the app if they are
100% sure the app is installed. This setting will cause the link to always open the app.
Possible values are "true" or "false"public static final int REFERRAL_CODE_LOCATION_REFERREE
Integer value indicating the user to reward for applying a referral code. In this
case, the user applying the referral code receives credit.public static final int REFERRAL_CODE_LOCATION_REFERRING_USER
Integer value indicating the user to reward for applying a referral code. In this
case, the user who created the referral code receives credit.public static final int REFERRAL_CODE_LOCATION_BOTH
Integer value indicating the user to reward for applying a referral code. In this
case, both the creator and applicant receive creditpublic static final int REFERRAL_CODE_AWARD_UNLIMITED
Integer value indicating the calculation type of the referral code. In this case,
the referral code can be applied continually.public static final int REFERRAL_CODE_AWARD_UNIQUE
Integer value indicating the calculation type of the referral code. In this case,
a user can only apply a specific referral code once.public static final int LINK_TYPE_UNLIMITED_USE
Integer value indicating the link type. In this case, the link can be used an
unlimited number of times.public static final int LINK_TYPE_ONE_TIME_USE
Integer value indicating the link type. In this case, the link can be used only
once. After initial use, subsequent attempts will not validate.public static Branch getInstance() throws BranchException
Singleton method to return the pre-initialised object of the type Branch.
Make sure your app is instantiating BranchApp before calling this method.
Branch objectBranchException - ExceptionApplication is not instance of BranchApp.public static Branch getInstance(android.content.Context context, java.lang.String branchKey)
Singleton method to return the pre-initialised, or newly initialise and return, a singleton
object of the type Branch.
context - A Context from which this call was made.branchKey - Your Branch key as a String.Branch object, either fetched from a pre-initialised
instance within the singleton class, or a newly instantiated object where
one was not already requested during the current app lifecycle.public static Branch getInstance(android.content.Context context)
Singleton method to return the pre-initialised, or newly initialise and return, a singleton
object of the type Branch.
Use this whenever you need to call a method directly on the Branch object.
context - A Context from which this call was made.Branch object, either fetched from a pre-initialised
instance within the singleton class, or a newly instantiated object where
one was not already requested during the current app lifecycle.public static Branch getTestInstance(android.content.Context context)
If you configured the your Strings file according to the guide, you'll be able to use the test version of your app by just calling this static method before calling initSession.
context - A Context from which this call was made.Branch object.public static Branch getAutoInstance(android.content.Context context)
Singleton method to return the pre-initialised, or newly initialise and return, a singleton
object of the type Branch.
Use this whenever you need to call a method directly on the Branch object.
context - A Context from which this call was made.Branch object, either fetched from a pre-initialised
instance within the singleton class, or a newly instantiated object where
one was not already requested during the current app lifecycle.public static Branch getAutoTestInstance(android.content.Context context)
If you configured the your Strings file according to the guide, you'll be able to use the test version of your app by just calling this static method before calling initSession.
context - A Context from which this call was made.Branch object.public void resetUserSession()
Manually sets the Boolean value, that indicates that the Branch API connection has
been initialised, to false - forcing re-initialisation.
public void setRetryCount(int retryCount)
Sets the number of times to re-attempt a timed-out request to the Branch API, before considering the request to have failed entirely. Default 5.
retryCount - An Integer specifying the number of times to retry before giving
up and declaring defeat.public void setRetryInterval(int retryInterval)
Sets the amount of time in milliseconds to wait before re-attempting a timed-out request to the Branch API. Default 3000 ms.
retryInterval - An Integer value specifying the number of milliseconds to
wait before re-attempting a timed-out request.public void setNetworkTimeout(int timeout)
Sets the duration in milliseconds that the system should wait for a response before considering any Branch API call to have timed out. Default 3000 ms.
Increase this to perform better in low network speed situations, but at the expense of responsiveness to error situation.
timeout - An Integer value specifying the number of milliseconds to wait before
considering the request to have timed out.public void setDebug()
Sets the library to function in debug mode, enabling logging of all requests.
If you want to flag debug, call this before initUserSession
public void disableAppList()
Calls the PrefHelper.disableExternAppListing() on the local instance to prevent
a list of installed apps from being returned to the Branch API.
public void disableTouchDebugging()
Calls the PrefHelper.disableTouchDebugging() ()} on the local instance to prevent
touch debugging feature.
public void disableSmartSession()
If there's further Branch API call happening within the two seconds, we then don't close the session; otherwise, we close the session after two seconds.
Call this method if you don't want this smart session feature and would rather manage the session yourself.
Note: smart session - we keep session alive for two seconds
public boolean initSession(Branch.BranchReferralInitListener callback)
Initialises a session with the Branch API, assigning a Branch.BranchReferralInitListener
to perform an action upon successful initialisation.
callback - A Branch.BranchReferralInitListener instance that will be called following
successful (or unsuccessful) initialisation of the session with the Branch API.Boolean value, indicating false if initialisation is
unsuccessful.public boolean initSession(Branch.BranchReferralInitListener callback, android.app.Activity activity)
Initialises a session with the Branch API, passing the Activity and assigning a
Branch.BranchReferralInitListener to perform an action upon successful initialisation.
callback - A Branch.BranchReferralInitListener instance that will be called
following successful (or unsuccessful) initialisation of the session
with the Branch API.activity - The calling Activity for context.Boolean value, indicating false if initialisation is
unsuccessful.public boolean initSession(Branch.BranchReferralInitListener callback, android.net.Uri data)
Initialises a session with the Branch API.
callback - A Branch.BranchReferralInitListener instance that will be called
following successful (or unsuccessful) initialisation of the session
with the Branch API.data - A Uri variable containing the details of the source link that
led to this initialisation action.Boolean value that will return false if the supplied
data parameter cannot be handled successfully - i.e. is not of a
valid URI format.public boolean initSession(Branch.BranchReferralInitListener callback, android.net.Uri data, android.app.Activity activity)
Initialises a session with the Branch API.
callback - A Branch.BranchReferralInitListener instance that will be called
following successful (or unsuccessful) initialisation of the session
with the Branch API.data - A Uri variable containing the details of the source link that
led to this initialisation action.activity - The calling Activity for context.Boolean value that will return false if the supplied
data parameter cannot be handled successfully - i.e. is not of a
valid URI format.public boolean initSession()
Initialises a session with the Branch API, without a callback or Activity.
Boolean value that returns false if unsuccessful.public boolean initSession(android.app.Activity activity)
Initialises a session with the Branch API, without a callback or Activity.
activity - The calling Activity for context.Boolean value that returns false if unsuccessful.public boolean initSessionWithData(android.net.Uri data)
Initialises a session with the Branch API, with associated data from the supplied
Uri.
data - A Uri variable containing the details of the source link that
led to this
initialisation action.Boolean value that returns false if unsuccessful.public boolean initSessionWithData(android.net.Uri data,
android.app.Activity activity)
Initialises a session with the Branch API, with associated data from the supplied
Uri.
data - A Uri variable containing the details of the source link that led to this
initialisation action.activity - The calling Activity for context.Boolean value that returns false if unsuccessful.public boolean initSession(boolean isReferrable)
Initialises a session with the Branch API, specifying whether the initialisation can count as a referrable action.
isReferrable - A Boolean value indicating whether this initialisation
session should be considered as potentially referrable or not.
By default, a user is only referrable if initSession results in a
fresh install. Overriding this gives you control of who is referrable.Boolean value that returns false if unsuccessful.public boolean initSession(boolean isReferrable,
android.app.Activity activity)
Initialises a session with the Branch API, specifying whether the initialisation can count
as a referrable action, and supplying the calling Activity for context.
isReferrable - A Boolean value indicating whether this initialisation
session should be considered as potentially referrable or not.
By default, a user is only referrable if initSession results in a
fresh install. Overriding this gives you control of who is referrable.activity - The calling Activity for context.Boolean value that returns false if unsuccessful.public boolean initSession(Branch.BranchReferralInitListener callback, boolean isReferrable, android.net.Uri data)
Initialises a session with the Branch API.
callback - A Branch.BranchReferralInitListener instance that will be called
following successful (or unsuccessful) initialisation of the session
with the Branch API.isReferrable - A Boolean value indicating whether this initialisation
session should be considered as potentially referrable or not.
By default, a user is only referrable if initSession results in a
fresh install. Overriding this gives you control of who is referrable.data - A Uri variable containing the details of the source link that
led to this initialisation action.Boolean value that returns false if unsuccessful.public boolean initSession(Branch.BranchReferralInitListener callback, boolean isReferrable, android.net.Uri data, android.app.Activity activity)
Initialises a session with the Branch API.
callback - A Branch.BranchReferralInitListener instance that will be called
following successful (or unsuccessful) initialisation of the session
with the Branch API.isReferrable - A Boolean value indicating whether this initialisation
session should be considered as potentially referrable or not.
By default, a user is only referrable if initSession results in a
fresh install. Overriding this gives you control of who is referrable.data - A Uri variable containing the details of the source link that
led to this initialisation action.activity - The calling Activity for context.Boolean value that returns false if unsuccessful.public boolean initSession(Branch.BranchReferralInitListener callback, boolean isReferrable)
Initialises a session with the Branch API.
callback - A Branch.BranchReferralInitListener instance that will be called
following successful (or unsuccessful) initialisation of the session
with the Branch API.isReferrable - A Boolean value indicating whether this initialisation
session should be considered as potentially referrable or not.
By default, a user is only referrable if initSession results in a
fresh install. Overriding this gives you control of who is referrable.Boolean value that returns false if unsuccessful.public boolean initSession(Branch.BranchReferralInitListener callback, boolean isReferrable, android.app.Activity activity)
Initialises a session with the Branch API.
callback - A Branch.BranchReferralInitListener instance that will be called
following successful (or unsuccessful) initialisation of the session
with the Branch API.isReferrable - A Boolean value indicating whether this initialisation
session should be considered as potentially referrable or not.
By default, a user is only referrable if initSession results in a
fresh install. Overriding this gives you control of who is referrable.activity - The calling Activity for context.Boolean value that returns false if unsuccessful.public void closeSession()
Closes the current session, dependent on the state of the
PrefHelper.getSmartSession() Boolean value. If true, take no action.
If false, close the sesion via the executeClose() method.
Note that if smartSession is enabled, closeSession cannot be called within a 2 second time span of another Branch action. This has to do with the method that Branch uses to keep a session alive during Activity transitions
public void setIdentity(java.lang.String userId)
Identifies the current user to the Branch API by supplying a unique identifier as a
String value. No callback.
userId - A String value containing the unique identifier of the user.public void setIdentity(java.lang.String userId,
Branch.BranchReferralInitListener callback)
Identifies the current user to the Branch API by supplying a unique identifier as a
String value, with a callback specified to perform a defined action upon successful
response to request.
userId - A String value containing the unique identifier of the user.callback - A Branch.BranchReferralInitListener callback instance that will return
the data associated with the user id being assigned, if available.public boolean isUserIdentified()
Boolean value that will return true only if user already has an identity.public void logout()
This method should be called if you know that a different person is about to use the app. For example, if you allow users to log out and let their friend use the app, you should call this to notify Branch to create a new user for this device. This will clear the first and latest params, as a new session is created.
public void loadActionCounts()
Fire-and-forget retrieval of action count for the current session. Without a callback.
public void loadActionCounts(Branch.BranchReferralStateChangedListener callback)
Gets the total action count, with a callback to perform a predefined action following successful report of state change. You'll then need to call getUniqueActions or getTotalActions in the callback to update the totals in your UX.
callback - A Branch.BranchReferralStateChangedListener callback instance that will
trigger actions defined therein upon a referral state change.public void loadRewards()
Fire-and-forget retrieval of rewards for the current session. Without a callback.
public void loadRewards(Branch.BranchReferralStateChangedListener callback)
Retrieves rewards for the current session, with a callback to perform a predefined action following successful report of state change. You'll then need to call getCredits in the callback to update the credit totals in your UX.
callback - A Branch.BranchReferralStateChangedListener callback instance that will
trigger actions defined therein upon a referral state change.public int getCredits()
Retrieve the number of credits available for the "default" bucket.
Integer value of the number credits available in the "default" bucket.public int getCreditsForBucket(java.lang.String bucket)
Integer of the number of credits available for use within the supplied
bucket name.bucket - A String value indicating the name of the bucket to get credits for.Integer value of the number credits available in the specified
bucket.public int getTotalCountsForAction(java.lang.String action)
Gets the total number of times that the specified action has been carried out.
action - A String value containing the name of the action to count.Integer value of the total number of times that an action has
been executed.public int getUniqueCountsForAction(java.lang.String action)
Gets the number of unique times that the specified action has been carried out.
action - A String value containing the name of the action to count.Integer value of the number of unique times that the
specified action has been carried out.public void redeemRewards(int count)
Redeems the specified number of credits from the "default" bucket, if there are sufficient credits within it. If the number to redeem exceeds the number available in the bucket, all of the available credits will be redeemed instead.
count - A Integer specifying the number of credits to attempt to redeem from
the bucket.public void redeemRewards(int count,
Branch.BranchReferralStateChangedListener callback)
Redeems the specified number of credits from the "default" bucket, if there are sufficient credits within it. If the number to redeem exceeds the number available in the bucket, all of the available credits will be redeemed instead.
count - A Integer specifying the number of credits to attempt to redeem from
the bucket.callback - A Branch.BranchReferralStateChangedListener callback instance that will
trigger actions defined therein upon a executing redeem rewards.public void redeemRewards(java.lang.String bucket,
int count)
Redeems the specified number of credits from the named bucket, if there are sufficient credits within it. If the number to redeem exceeds the number available in the bucket, all of the available credits will be redeemed instead.
bucket - A String value containing the name of the referral bucket to attempt
to redeem credits from.count - A Integer specifying the number of credits to attempt to redeem from
the specified bucket.public void redeemRewards(java.lang.String bucket,
int count,
Branch.BranchReferralStateChangedListener callback)
Redeems the specified number of credits from the named bucket, if there are sufficient credits within it. If the number to redeem exceeds the number available in the bucket, all of the available credits will be redeemed instead.
bucket - A String value containing the name of the referral bucket to attempt
to redeem credits from.count - A Integer specifying the number of credits to attempt to redeem from
the specified bucket.callback - A Branch.BranchReferralStateChangedListener callback instance that will
trigger actions defined therein upon a executing redeem rewards.public void getCreditHistory(Branch.BranchListResponseListener callback)
Gets the credit history of the specified bucket and triggers a callback to handle the response.
callback - A Branch.BranchListResponseListener callback instance that will trigger
actions defined therein upon receipt of a response to a create link request.public void getCreditHistory(java.lang.String bucket,
Branch.BranchListResponseListener callback)
Gets the credit history of the specified bucket and triggers a callback to handle the response.
bucket - A String value containing the name of the referral bucket that the
code will belong to.callback - A Branch.BranchListResponseListener callback instance that will trigger
actions defined therein upon receipt of a response to a create link request.public void getCreditHistory(java.lang.String afterId,
int length,
Branch.CreditHistoryOrder order,
Branch.BranchListResponseListener callback)
Gets the credit history of the specified bucket and triggers a callback to handle the response.
afterId - A String value containing the ID of the history record to begin after.
This allows for a partial history to be retrieved, rather than the entire
credit history of the bucket.length - A Integer value containing the number of credit history records to
return.order - A Branch.CreditHistoryOrder object indicating which order the results should
be returned in.
Valid choices:
callback - A Branch.BranchListResponseListener callback instance that will trigger
actions defined therein upon receipt of a response to a create link request.public void getCreditHistory(java.lang.String bucket,
java.lang.String afterId,
int length,
Branch.CreditHistoryOrder order,
Branch.BranchListResponseListener callback)
Gets the credit history of the specified bucket and triggers a callback to handle the response.
bucket - A String value containing the name of the referral bucket that the
code will belong to.afterId - A String value containing the ID of the history record to begin after.
This allows for a partial history to be retrieved, rather than the entire
credit history of the bucket.length - A Integer value containing the number of credit history records to
return.order - A Branch.CreditHistoryOrder object indicating which order the results should
be returned in.
Valid choices:
callback - A Branch.BranchListResponseListener callback instance that will trigger
actions defined therein upon receipt of a response to a create link request.public void userCompletedAction(java.lang.String action,
org.json.JSONObject metadata)
A void call to indicate that the user has performed a specific action and for that to be reported to the Branch API, with additional app-defined meta data to go along with that action.
action - A String value to be passed as an action that the user has carried
out. For example "registered" or "logged in".metadata - A JSONObject containing app-defined meta-data to be attached to a
user action that has just been completed.public void userCompletedAction(java.lang.String action)
A void call to indicate that the user has performed a specific action and for that to be reported to the Branch API.
action - A String value to be passed as an action that the user has carried
out. For example "registered" or "logged in".public org.json.JSONObject getFirstReferringParams()
Returns the parameters associated with the link that referred the user. This is only set once, the first time the user is referred by a link. Think of this as the user referral parameters. It is also only set if isReferrable is equal to true, which by default is only true on a fresh install (not upgrade or reinstall). This will change on setIdentity (if the user already exists from a previous device) and logout.
JSONObject containing the install-time parameters as configured
locally.public org.json.JSONObject getLatestReferringParams()
Returns the parameters associated with the link that referred the session. If a user clicks a link, and then opens the app, initSession will return the paramters of the link and then set them in as the latest parameters to be retrieved by this method. By default, sessions persist for the duration of time that the app is in focus. For example, if you minimize the app, these parameters will be cleared when closeSession is called.
JSONObject containing the latest referring parameters as
configured locally.public java.lang.String getShortUrlSync()
Configures and requests a short URL to be generated by the Branch servers, via a synchronous call; with a duration specified within which an app session should be matched to the link.
String containing the resulting short URL.public java.lang.String getShortUrlSync(org.json.JSONObject params)
Configures and requests a short URL to be generated by the Branch servers, via a synchronous call; with a duration specified within which an app session should be matched to the link.
params - A JSONObject value containing the deep linked params associated with
the link that will be passed into a new app session when clickedString containing the resulting short URL.public java.lang.String getReferralUrlSync(java.lang.String channel,
org.json.JSONObject params)
Configures and requests a referral URL to be generated by the Branch servers, via a synchronous call; with a duration specified within which an app session should be matched to the link.
channel - A String denoting the channel that the link belongs to. Should not
exceed 128 characters.params - A JSONObject value containing the deep linked params associated with
the link that will be passed into a new app session when clickedString containing the resulting referral URL.public java.lang.String getReferralUrlSync(java.util.Collection<java.lang.String> tags,
java.lang.String channel,
org.json.JSONObject params)
Configures and requests a referral URL to be generated by the Branch servers, via a synchronous call; with a duration specified within which an app session should be matched to the link.
tags - An iterable Collection of String tags associated with a deep
link.channel - A String denoting the channel that the link belongs to. Should not
exceed 128 characters.params - A JSONObject value containing the deep linked params associated with
the link that will be passed into a new app session when clickedString containing the resulting referral URL.public java.lang.String getContentUrlSync(java.lang.String channel,
org.json.JSONObject params)
Configures and requests a content URL (defined as feature = sharing) to be generated by the Branch servers, via a synchronous call
channel - A String denoting the channel that the link belongs to. Should not
exceed 128 characters.params - A JSONObject value containing the deep linked params associated with
the link that will be passed into a new app session when clickedString containing the resulting content URL.public java.lang.String getContentUrlSync(java.util.Collection<java.lang.String> tags,
java.lang.String channel,
org.json.JSONObject params)
Configures and requests a content URL (defined as feature = sharing) to be generated by the Branch servers, via a synchronous call
tags - An iterable Collection of String tags associated with a deep
link.channel - A String denoting the channel that the link belongs to. Should not
exceed 128 characters.params - A JSONObject value containing the deep linked params associated with
the link that will be passed into a new app session when clickedString containing the resulting content URL.public java.lang.String getShortUrlSync(java.lang.String channel,
java.lang.String feature,
java.lang.String stage,
org.json.JSONObject params)
Configures and requests a short URL to be generated by the Branch servers, via a synchronous call; with a duration specified within which an app session should be matched to the link.
channel - A String denoting the channel that the link belongs to. Should not
exceed 128 characters.feature - A String value identifying the feature that the link makes use of.
Should not exceed 128 characters.stage - A String value identifying the stage in an application or user flow process.
Should not exceed 128 characters.params - A JSONObject value containing the deep linked params associated with
the link that will be passed into a new app session when clickedString containing the resulting short URL.public java.lang.String getShortUrlSync(java.lang.String alias,
java.lang.String channel,
java.lang.String feature,
java.lang.String stage,
org.json.JSONObject params)
Configures and requests a short URL to be generated by the Branch servers, via a synchronous call; with a duration specified within which an app session should be matched to the link.
alias - Link 'alias' can be used to label the endpoint on the link.
For example: http://bnc.lt/AUSTIN28. Should not exceed 128 characters
channel - A String denoting the channel that the link belongs to. Should not
exceed 128 characters.feature - A String value identifying the feature that the link makes use of.
Should not exceed 128 characters.stage - A String value identifying the stage in an application or user flow
process. Should not exceed 128 characters.params - A JSONObject value containing the deep linked params associated with
the link that will be passed into a new app session when clickedString containing the resulting short URL.public java.lang.String getShortUrlSync(int type,
java.lang.String channel,
java.lang.String feature,
java.lang.String stage,
org.json.JSONObject params)
Configures and requests a short URL to be generated by the Branch servers, via a synchronous call; with a duration specified within which an app session should be matched to the link.
type - An int that can be used for scenarios where you want the link to
only deep link the first time.channel - A String denoting the channel that the link belongs to. Should not
exceed 128 characters.feature - A String value identifying the feature that the link makes use of.
Should not exceed 128 characters.stage - A String value identifying the stage in an application or user flow
process. Should not exceed 128 characters.params - A JSONObject value containing the deep linked params associated with
the link that will be passed into a new app session when clickedString containing the resulting short URL.public java.lang.String getShortUrlSync(java.lang.String channel,
java.lang.String feature,
java.lang.String stage,
org.json.JSONObject params,
int duration)
Configures and requests a short URL to be generated by the Branch servers, via a synchronous call; with a duration specified within which an app session should be matched to the link.
channel - A String denoting the channel that the link belongs to. Should not
exceed 128 characters.feature - A String value identifying the feature that the link makes use of.
Should not exceed 128 characters.stage - A String value identifying the stage in an application or user flow
process. Should not exceed 128 characters.params - A JSONObject value containing the deep linked params associated with
the link that will be passed into a new app session when clickedduration - A Integer value specifying the time that Branch allows a click to
remain outstanding and be eligible to be matched with a new app session.String containing the resulting short URL.public java.lang.String getShortUrlSync(java.util.Collection<java.lang.String> tags,
java.lang.String channel,
java.lang.String feature,
java.lang.String stage,
org.json.JSONObject params)
Configures and requests a short URL to be generated by the Branch servers, via a synchronous call; with a duration specified within which an app session should be matched to the link.
tags - An iterable Collection of String tags associated with a deep
link.channel - A String denoting the channel that the link belongs to. Should not
exceed 128 characters.feature - A String value identifying the feature that the link makes use of.
Should not exceed 128 characters.stage - A String value identifying the stage in an application or user flow
process. Should not exceed 128 characters.params - A JSONObject value containing the deep linked params associated with
the link that will be passed into a new app session when clickedString containing the resulting short URL.public java.lang.String getShortUrlSync(java.lang.String alias,
java.util.Collection<java.lang.String> tags,
java.lang.String channel,
java.lang.String feature,
java.lang.String stage,
org.json.JSONObject params)
Configures and requests a short URL to be generated by the Branch servers, via a synchronous call; with a duration specified within which an app session should be matched to the link.
alias - Link 'alias' can be used to label the endpoint on the link.
For example: http://bnc.lt/AUSTIN28. Should not exceed 128 characters
tags - An iterable Collection of String tags associated with a deep
link.channel - A String denoting the channel that the link belongs to. Should not
exceed 128 characters.feature - A String value identifying the feature that the link makes use of.
Should not exceed 128 characters.stage - A String value identifying the stage in an application or user flow
process. Should not exceed 128 characters.params - A JSONObject value containing the deep linked params associated with
the link that will be passed into a new app session when clickedString containing the resulting short URL.public java.lang.String getShortUrlSync(int type,
java.util.Collection<java.lang.String> tags,
java.lang.String channel,
java.lang.String feature,
java.lang.String stage,
org.json.JSONObject params)
Configures and requests a short URL to be generated by the Branch servers, via a synchronous call; with a duration specified within which an app session should be matched to the link.
type - An int that can be used for scenarios where you want the link to
only deep link the first time.tags - An iterable Collection of String tags associated with a deep
link.channel - A String denoting the channel that the link belongs to. Should not
exceed 128 characters.feature - A String value identifying the feature that the link makes use of.
Should not exceed 128 characters.stage - A String value identifying the stage in an application or user flow
process. Should not exceed 128 characters.params - A JSONObject value containing the deep linked params associated with
the link that will be passed into a new app session when clickedString containing the resulting short URL.public java.lang.String getShortUrlSync(java.util.Collection<java.lang.String> tags,
java.lang.String channel,
java.lang.String feature,
java.lang.String stage,
org.json.JSONObject params,
int duration)
Configures and requests a short URL to be generated by the Branch servers, via a synchronous call; with a duration specified within which an app session should be matched to the link.
tags - An iterable Collection of String tags associated with a deep
link.channel - A String denoting the channel that the link belongs to. Should not
exceed 128 characters.feature - A String value identifying the feature that the link makes use of.
Should not exceed 128 characters.stage - A String value identifying the stage in an application or user flow
process. Should not exceed 128 characters.params - A JSONObject value containing the deep linked params associated with
the link that will be passed into a new app session when clickedduration - A Integer value specifying the time that Branch allows a click to
remain outstanding and be eligible to be matched with a new app session.String containing the resulting short URL.public void getShortUrl(Branch.BranchLinkCreateListener callback)
Configures and requests a short URL to be generated by the Branch servers.
callback - A Branch.BranchLinkCreateListener callback instance that will trigger
actions defined therein upon receipt of a response to a create link request.public void getShortUrl(org.json.JSONObject params,
Branch.BranchLinkCreateListener callback)
Configures and requests a short URL to be generated by the Branch servers.
params - A JSONObject value containing the deep linked params associated with
the link that will be passed into a new app session when clickedcallback - A Branch.BranchLinkCreateListener callback instance that will trigger
actions defined therein upon receipt of a response to a create link request.BranchLinkData,
BranchLinkData.putParams(String),
Branch.BranchLinkCreateListenerpublic void getReferralUrl(java.lang.String channel,
org.json.JSONObject params,
Branch.BranchLinkCreateListener callback)
Configures and requests a referral URL (feature = referral) to be generated by the Branch servers.
channel - A String denoting the channel that the link belongs to. Should not
exceed 128 characters.params - A JSONObject value containing the deep linked params associated with
the link that will be passed into a new app session when clickedcallback - A Branch.BranchLinkCreateListener callback instance that will trigger
actions defined therein upon receipt of a response to a create link request.BranchLinkData,
BranchLinkData.putChannel(String),
BranchLinkData.putParams(String),
Branch.BranchLinkCreateListenerpublic void getReferralUrl(java.util.Collection<java.lang.String> tags,
java.lang.String channel,
org.json.JSONObject params,
Branch.BranchLinkCreateListener callback)
Configures and requests a referral URL (feature = referral) to be generated by the Branch servers.
tags - An iterable Collection of String tags associated with a deep
link.channel - A String denoting the channel that the link belongs to. Should not
exceed 128 characters.params - A JSONObject value containing the deep linked params associated with
the link that will be passed into a new app session when clickedcallback - A Branch.BranchLinkCreateListener callback instance that will trigger
actions defined therein upon receipt of a response to a create link request.BranchLinkData,
BranchLinkData.putTags(Collection),
BranchLinkData.putChannel(String),
BranchLinkData.putParams(String),
Branch.BranchLinkCreateListenerpublic void getContentUrl(java.lang.String channel,
org.json.JSONObject params,
Branch.BranchLinkCreateListener callback)
Configures and requests a content URL (defined as feature = sharing) to be generated by the Branch servers.
channel - A String denoting the channel that the link belongs to. Should not
exceed 128 characters.params - A JSONObject value containing the deep linked params associated with
the link that will be passed into a new app session when clickedcallback - A Branch.BranchLinkCreateListener callback instance that will trigger
actions defined therein upon receipt of a response to a create link request.BranchLinkData,
BranchLinkData.putChannel(String),
BranchLinkData.putParams(String),
Branch.BranchLinkCreateListenerpublic void getContentUrl(java.util.Collection<java.lang.String> tags,
java.lang.String channel,
org.json.JSONObject params,
Branch.BranchLinkCreateListener callback)
Configures and requests a content URL (defined as feature = sharing) to be generated by the Branch servers.
tags - An iterable Collection of String tags associated with a deep
link.channel - A String denoting the channel that the link belongs to. Should not
exceed 128 characters.params - A JSONObject value containing the deep linked params associated with
the link that will be passed into a new app session when clickedcallback - A Branch.BranchLinkCreateListener callback instance that will trigger
actions defined therein upon receipt of a response to a create link request.BranchLinkData,
BranchLinkData.putTags(Collection),
BranchLinkData.putChannel(String),
BranchLinkData.putParams(String),
Branch.BranchLinkCreateListenerpublic void getShortUrl(java.lang.String channel,
java.lang.String feature,
java.lang.String stage,
org.json.JSONObject params,
Branch.BranchLinkCreateListener callback)
Configures and requests a short URL to be generated by the Branch servers.
channel - A String denoting the channel that the link belongs to. Should not
exceed 128 characters.feature - A String value identifying the feature that the link makes use of.
Should not exceed 128 characters.stage - A String value identifying the stage in an application or user flow
process. Should not exceed 128 characters.params - A JSONObject value containing the deep linked params associated with
the link that will be passed into a new app session when clickedcallback - A Branch.BranchLinkCreateListener callback instance that will trigger
actions defined therein upon receipt of a response to a create link request.BranchLinkData,
BranchLinkData.putChannel(String),
BranchLinkData.putFeature(String),
BranchLinkData.putStage(String),
BranchLinkData.putParams(String),
Branch.BranchLinkCreateListenerpublic void getShortUrl(java.lang.String alias,
java.lang.String channel,
java.lang.String feature,
java.lang.String stage,
org.json.JSONObject params,
Branch.BranchLinkCreateListener callback)
Configures and requests a short URL to be generated by the Branch servers.
alias - Link 'alias' can be used to label the endpoint on the link.
For example: http://bnc.lt/AUSTIN28. Should not exceed 128 characters
channel - A String denoting the channel that the link belongs to. Should not
exceed 128 characters.feature - A String value identifying the feature that the link makes use of.
Should not exceed 128 characters.stage - A String value identifying the stage in an application or user flow process.
Should not exceed 128 characters.params - A JSONObject value containing the deep linked params associated with
the link that will be passed into a new app session when clickedcallback - A Branch.BranchLinkCreateListener callback instance that will trigger
actions defined therein upon receipt of a response to a create link request.BranchLinkData,
BranchLinkData.putAlias(String),
BranchLinkData.putChannel(String),
BranchLinkData.putFeature(String),
BranchLinkData.putStage(String),
BranchLinkData.putParams(String),
Branch.BranchLinkCreateListenerpublic void getShortUrl(int type,
java.lang.String channel,
java.lang.String feature,
java.lang.String stage,
org.json.JSONObject params,
Branch.BranchLinkCreateListener callback)
Configures and requests a short URL to be generated by the Branch servers.
type - An int that can be used for scenarios where you want the link to
only deep link the first time.channel - A String denoting the channel that the link belongs to. Should not
exceed 128 characters.feature - A String value identifying the feature that the link makes use of.
Should not exceed 128 characters.stage - A String value identifying the stage in an application or user flow process.
Should not exceed 128 characters.params - A JSONObject value containing the deep linked params associated with
the link that will be passed into a new app session when clickedcallback - A Branch.BranchLinkCreateListener callback instance that will trigger
actions defined therein upon receipt of a response to a create link request.BranchLinkData,
BranchLinkData.putType(int),
BranchLinkData.putChannel(String),
BranchLinkData.putFeature(String),
BranchLinkData.putStage(String),
BranchLinkData.putParams(String),
Branch.BranchLinkCreateListenerpublic void getShortUrl(java.lang.String channel,
java.lang.String feature,
java.lang.String stage,
org.json.JSONObject params,
int duration,
Branch.BranchLinkCreateListener callback)
Configures and requests a short URL to be generated by the Branch servers.
channel - A String denoting the channel that the link belongs to. Should not
exceed 128 characters.feature - A String value identifying the feature that the link makes use of.
Should not exceed 128 characters.stage - A String value identifying the stage in an application or user flow
process. Should not exceed 128 characters.params - A JSONObject value containing the deep linked params associated with
the link that will be passed into a new app session when clickedduration - An int the time that Branch allows a click to remain outstanding and
be eligible to be matched with a new app session.callback - A Branch.BranchLinkCreateListener callback instance that will trigger
actions defined therein upon receipt of a response to a create link request.BranchLinkData,
BranchLinkData.putTags(Collection),
BranchLinkData.putChannel(String),
BranchLinkData.putFeature(String),
BranchLinkData.putStage(String),
BranchLinkData.putParams(String),
Branch.BranchLinkCreateListenerpublic void getShortUrl(java.util.Collection<java.lang.String> tags,
java.lang.String channel,
java.lang.String feature,
java.lang.String stage,
org.json.JSONObject params,
Branch.BranchLinkCreateListener callback)
Configures and requests a short URL to be generated by the Branch servers.
tags - An iterable Collection of String tags associated with a deep
link.channel - A String denoting the channel that the link belongs to. Should not
exceed 128 characters.feature - A String value identifying the feature that the link makes use of.
Should not exceed 128 characters.stage - A String value identifying the stage in an application or user flow
process. Should not exceed 128 characters.params - A JSONObject value containing the deep linked params associated with
the link that will be passed into a new app session when clickedcallback - A Branch.BranchLinkCreateListener callback instance that will trigger
actions defined therein upon receipt of a response to a create link request.BranchLinkData,
BranchLinkData.putTags(Collection),
BranchLinkData.putChannel(String),
BranchLinkData.putFeature(String),
BranchLinkData.putStage(String),
BranchLinkData.putParams(String),
Branch.BranchLinkCreateListenerpublic void getShortUrl(java.lang.String alias,
java.util.Collection<java.lang.String> tags,
java.lang.String channel,
java.lang.String feature,
java.lang.String stage,
org.json.JSONObject params,
Branch.BranchLinkCreateListener callback)
Configures and requests a short URL to be generated by the Branch servers.
alias - Link 'alias' can be used to label the endpoint on the link.
Should not exceed 128 characters.
For example: http://bnc.lt/AUSTIN28.
tags - An iterable Collection of String tags associated with a deep
link.channel - A String denoting the channel that the link belongs to. Should not
exceed 128 characters.feature - A String value identifying the feature that the link makes use of.
Should not exceed 128 characters.stage - A String value identifying the stage in an application or user flow
process. Should not exceed 128 characters.params - A JSONObject value containing the deep linked params associated with
the link that will be passed into a new app session when clickedcallback - A Branch.BranchLinkCreateListener callback instance that will trigger
actions defined therein upon receipt of a response to a create link request.BranchLinkData,
BranchLinkData.putAlias(String),
BranchLinkData.putTags(Collection),
BranchLinkData.putChannel(String),
BranchLinkData.putFeature(String),
BranchLinkData.putStage(String),
BranchLinkData.putParams(String),
Branch.BranchLinkCreateListenerpublic void getShortUrl(int type,
java.util.Collection<java.lang.String> tags,
java.lang.String channel,
java.lang.String feature,
java.lang.String stage,
org.json.JSONObject params,
Branch.BranchLinkCreateListener callback)
Configures and requests a short URL to be generated by the Branch servers.
type - An int that can be used for scenarios where you want the link to
only deep link the first time.tags - An iterable Collection of String tags associated with a deep
link.channel - A String denoting the channel that the link belongs to. Should not
exceed 128 characters.feature - A String value identifying the feature that the link makes use of.
Should not exceed 128 characters.stage - A String value identifying the stage in an application or user flow
process. Should not exceed 128 characters.params - A JSONObject value containing the deep linked params associated with
the link that will be passed into a new app session when clickedcallback - A Branch.BranchLinkCreateListener callback instance that will trigger
actions defined therein upon receipt of a response to a create link request.BranchLinkData,
BranchLinkData.putType(int),
BranchLinkData.putTags(Collection),
BranchLinkData.putChannel(String),
BranchLinkData.putFeature(String),
BranchLinkData.putStage(String),
BranchLinkData.putParams(String),
Branch.BranchLinkCreateListenerpublic void getShortUrl(java.util.Collection<java.lang.String> tags,
java.lang.String channel,
java.lang.String feature,
java.lang.String stage,
org.json.JSONObject params,
int duration,
Branch.BranchLinkCreateListener callback)
Configures and requests a short URL to be generated by the Branch servers.
tags - An iterable Collection of String tags associated with a deep
link.channel - A String denoting the channel that the link belongs to. Should not
exceed 128 characters.feature - A String value identifying the feature that the link makes use of.
Should not exceed 128 characters.stage - A String value identifying the stage in an application or user flow
process. Should not exceed 128 characters.params - A JSONObject value containing the deep linked params associated with
the link that will be passed into a new app session when clickedduration - An int the time that Branch allows a click to remain outstanding
and be eligible to be matched with a new app session.callback - A Branch.BranchLinkCreateListener callback instance that will trigger
actions defined therein upon receipt of a response to a create link request.BranchLinkData,
BranchLinkData.putTags(Collection),
BranchLinkData.putChannel(String),
BranchLinkData.putFeature(String),
BranchLinkData.putStage(String),
BranchLinkData.putParams(String),
BranchLinkData.putDuration(int),
Branch.BranchLinkCreateListenerpublic void getReferralCode(Branch.BranchReferralInitListener callback)
Configures and requests a referral code to be generated by the Branch servers.
callback - A Branch.BranchReferralInitListener callback instance that will trigger
actions defined therein upon receipt of a response to a referral code request.public void getReferralCode(int amount,
Branch.BranchReferralInitListener callback)
Configures and requests a referral code to be generated by the Branch servers.
amount - An Integer value of credits associated with this referral code.callback - A Branch.BranchReferralInitListener callback instance that will trigger
actions defined therein upon receipt of a response to a referral code request.public void getReferralCode(java.lang.String prefix,
int amount,
Branch.BranchReferralInitListener callback)
Configures and requests a referral code to be generated by the Branch servers.
prefix - A String containing the developer-specified prefix code to be applied
to the start of a referral code. e.g. for code OFFER4867, the prefix would
be "OFFER".amount - An Integer value of credits associated with this referral code.callback - A Branch.BranchReferralInitListener callback instance that will trigger
actions defined therein upon receipt of a response to a referral code request.public void getReferralCode(int amount,
java.util.Date expiration,
Branch.BranchReferralInitListener callback)
Configures and requests a referral code to be generated by the Branch servers.
amount - An Integer value of credits associated with this referral code.expiration - Optional expiration Date of the offer code.callback - A Branch.BranchReferralInitListener callback instance that will trigger
actions defined therein upon receipt of a response to a referral code
request.public void getReferralCode(java.lang.String prefix,
int amount,
java.util.Date expiration,
Branch.BranchReferralInitListener callback)
Configures and requests a referral code to be generated by the Branch servers.
prefix - A String containing the developer-specified prefix code to be
applied to the start of a referral code. e.g. for code OFFER4867, the
prefix would be "OFFER".amount - An Integer value of credits associated with this referral code.expiration - Optional expiration Date of the offer code.callback - A Branch.BranchReferralInitListener callback instance that will trigger
actions defined therein upon receipt of a response to a referral code
request.public void getReferralCode(java.lang.String prefix,
int amount,
int calculationType,
int location,
Branch.BranchReferralInitListener callback)
Configures and requests a referral code to be generated by the Branch servers.
prefix - A String containing the developer-specified prefix code to be
applied to the start of a referral code. e.g. for code OFFER4867, the
prefix would be "OFFER".amount - An Integer value of credits associated with this referral code.calculationType - The type of referral calculation. i.e.
LINK_TYPE_UNLIMITED_USE or
LINK_TYPE_ONE_TIME_USElocation - The user to reward for applying the referral code.
Valid options:
callback - A Branch.BranchReferralInitListener callback instance that will
trigger actions defined therein upon receipt of a response to a
referral code request.public void getReferralCode(java.lang.String prefix,
int amount,
java.util.Date expiration,
java.lang.String bucket,
int calculationType,
int location,
Branch.BranchReferralInitListener callback)
Configures and requests a referral code to be generated by the Branch servers.
prefix - A String containing the developer-specified prefix code to
be applied to the start of a referral code. e.g. for code OFFER4867,
the prefix would be "OFFER".amount - An Integer value of credits associated with this referral code.expiration - Optional expiration Date of the offer code.bucket - A String value containing the name of the referral bucket
that the code will belong to.calculationType - The type of referral calculation. i.e.
LINK_TYPE_UNLIMITED_USE or
LINK_TYPE_ONE_TIME_USElocation - The user to reward for applying the referral code.
Valid options:
callback - A Branch.BranchReferralInitListener callback instance that will
trigger actions defined therein upon receipt of a response to a
referral code request.public void validateReferralCode(java.lang.String code,
Branch.BranchReferralInitListener callback)
Validates the supplied referral code on initialisation without applying it to the current session.
code - A String object containing the referral code supplied.callback - A Branch.BranchReferralInitListener callback to handle the server response
of the referral submission request.public void applyReferralCode(java.lang.String code,
Branch.BranchReferralInitListener callback)
Applies a supplied referral code to the current user session upon initialisation.
code - A String object containing the referral code supplied.callback - A Branch.BranchReferralInitListener callback to handle the server
response of the referral submission request.Branch.BranchReferralInitListener