public class BranchShortLinkBuilder
extends java.lang.Object
Class for creating builder for getting a short url with Branch. This builder provide an easy and flexible way to configure and create a short url Synchronously or asynchronously.
| Modifier and Type | Field and Description |
|---|---|
protected java.lang.String |
alias_ |
protected Branch |
branchReferral_ |
protected java.lang.String |
channel_ |
protected int |
duration_ |
protected java.lang.String |
feature_ |
protected org.json.JSONObject |
params_ |
protected java.lang.String |
stage_ |
protected java.util.ArrayList<java.lang.String> |
tags_ |
protected int |
type_ |
| Constructor and Description |
|---|
BranchShortLinkBuilder(android.content.Context context) |
| Modifier and Type | Method and Description |
|---|---|
T |
addParameters(java.lang.String key,
org.json.JSONArray value) |
T |
addParameters(java.lang.String key,
java.lang.String value)
Adds the the given key value pair to the parameters associated with this link.
|
T |
addTag(java.lang.String tag)
Adds a tag to the iterable collection of name associated with a deep link.
|
T |
addTags(java.util.List<java.lang.String> tags)
Adds a tag to the iterable collection of name associated with a deep link.
|
void |
generateShortUrl(Branch.BranchLinkCreateListener callback)
Configures and requests a short URL to be generated by the Branch servers, via a asynchronous
call; The
Branch.BranchLinkCreateListener is called back with the url when the url is generated. |
protected void |
generateUrl(Branch.BranchLinkCreateListener callback) |
java.lang.String |
getShortUrl()
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.
|
protected java.lang.String |
getUrl() |
BranchShortLinkBuilder |
setAlias(java.lang.String alias)
Sets the alias for this link.
|
BranchShortLinkBuilder |
setChannel(java.lang.String channel)
Sets the channel for this link.
|
BranchShortLinkBuilder |
setDuration(int duration)
Sets the amount of time that Branch allows a click to remain outstanding.
|
BranchShortLinkBuilder |
setFeature(java.lang.String feature)
Set a name that identifies the feature that the link makes use of.
|
BranchShortLinkBuilder |
setParameters(org.json.JSONObject parameters)
Set the parameters associated with the link.
|
BranchShortLinkBuilder |
setStage(java.lang.String stage)
Set a name that identify the stage in an application or user flow process.
|
BranchShortLinkBuilder |
setType(int type)
Sets an
int that can be used for scenarios where you want the link to
only deep link the first time or unlimited times |
protected org.json.JSONObject params_
protected java.lang.String channel_
protected java.lang.String feature_
protected java.lang.String stage_
protected java.lang.String alias_
protected int type_
protected int duration_
protected java.util.ArrayList<java.lang.String> tags_
protected Branch branchReferral_
public BranchShortLinkBuilder(android.content.Context context)
public BranchShortLinkBuilder setAlias(java.lang.String alias)
Sets the alias for this 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
public BranchShortLinkBuilder setChannel(java.lang.String channel)
Sets the channel for this link.
channel - A String denoting the channel that the link belongs to. Should not
exceed 128 characters.public BranchShortLinkBuilder setDuration(int duration)
Sets the amount of time that Branch allows a click to remain outstanding.
duration - 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.public BranchShortLinkBuilder setFeature(java.lang.String feature)
Set a name that identifies the feature that the link makes use of.
feature - A String value identifying the feature that the link makes use of.
Should not exceed 128 characters.public BranchShortLinkBuilder setParameters(org.json.JSONObject parameters)
Set the parameters associated with the link.
parameters - A JSONObject value containing the deep linked params associated with
the link that will be passed into a new app session when clicked.
addParameters if you want to set parameters as individual key value.public BranchShortLinkBuilder setStage(java.lang.String stage)
Set a name that identify the stage in an application or user flow process.
stage - A String value identifying the stage in an application or user flow
process. Should not exceed 128 characters.public BranchShortLinkBuilder setType(int type)
Sets an int that can be used for scenarios where you want the link to
only deep link the first time or unlimited times
type - int that can be used for scenarios where you want the link to
only deep link the first time.Possible values is Branch.LINK_TYPE_ONE_TIME_USE or Branch.LINK_TYPE_UNLIMITED_USEpublic java.lang.String getShortUrl()
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. Null is returned in case of an error or if Branch is not initialised.public void generateShortUrl(Branch.BranchLinkCreateListener callback)
Configures and requests a short URL to be generated by the Branch servers, via a asynchronous
call; The Branch.BranchLinkCreateListener is called back with the url when the url is generated.
callback - A Branch.BranchLinkCreateListener callback instance that will triggerpublic T addTag(java.lang.String tag)
Adds a tag to the iterable collection of name associated with a deep link.
tag - String tags associated with a deep link.public T addTags(java.util.List<java.lang.String> tags)
Adds a tag to the iterable collection of name associated with a deep link.
tags - List with collection of tags associated with a deep link.public T addParameters(java.lang.String key,
java.lang.String value)
Adds the the given key value pair to the parameters associated with this link.
key - A String with value of key for the parametervalue - A String with value of value for the parameterpublic T addParameters(java.lang.String key,
org.json.JSONArray value)
protected java.lang.String getUrl()
protected void generateUrl(Branch.BranchLinkCreateListener callback)