public class BranchUniversalObject
extends java.lang.Object
implements android.os.Parcelable
Class represents a single piece of content within your app, as well as any associated metadata. It provides convenient methods for sharing, deep linking, and tracking how often that content is viewed. This information is then used to provide you with powerful content analytics and deep linking.
| Modifier and Type | Class and Description |
|---|---|
static class |
BranchUniversalObject.CONTENT_INDEX_MODE
Defines the Content indexing modes
PUBLIC | PRIVATE
|
static interface |
BranchUniversalObject.RegisterViewStatusListener
Callback interface for listening register content view status
|
| Modifier and Type | Field and Description |
|---|---|
static android.os.Parcelable.Creator |
CREATOR |
| Constructor and Description |
|---|
BranchUniversalObject()
Create a BranchUniversalObject with the given content.
|
| Modifier and Type | Method and Description |
|---|---|
BranchUniversalObject |
addContentMetadata(java.util.HashMap<java.lang.String,java.lang.String> metadata)
Adds the the given set of key value pairs to the metadata associated with this content.
|
BranchUniversalObject |
addContentMetadata(java.lang.String key,
java.lang.String value)
Adds the the given set of key value pair to the metadata associated with this content.
|
BranchUniversalObject |
addKeyWord(java.lang.String keyword)
Add a keyword associated with the content referred
|
BranchUniversalObject |
addKeyWords(java.util.ArrayList<java.lang.String> keywords)
Adds any keywords associated with the content referred
|
org.json.JSONObject |
convertToJson()
Convert the BUO to corresponding Json representation
|
static BranchUniversalObject |
createInstance(org.json.JSONObject jsonObject)
Creates a new BranchUniversalObject with the data provided by
JSONObject. |
int |
describeContents() |
void |
generateShortUrl(android.content.Context context,
LinkProperties linkProperties,
Branch.BranchLinkCreateListener callback) |
java.lang.String |
getCanonicalIdentifier()
Get the canonical identifier for this BranchUniversalObject
|
java.lang.String |
getCanonicalUrl()
Get the canonical url for this BranchUniversalObject
|
java.lang.String |
getDescription()
Get description for the content for the content referred by this object
|
long |
getExpirationTime()
Get expiry date for the content and any associated links.
|
java.lang.String |
getImageUrl()
Get the url to any image associated with this content.
|
java.util.ArrayList<java.lang.String> |
getKeywords()
Get the keywords associated with this
BranchUniversalObject |
org.json.JSONArray |
getKeywordsJsonArray()
Get the keywords associated with this
BranchUniversalObject |
java.util.HashMap<java.lang.String,java.lang.String> |
getMetadata()
Get the meta data provided for the content referred bt this object
|
static BranchUniversalObject |
getReferredBranchUniversalObject()
Get the
BranchUniversalObject associated with the latest deep linking. |
java.lang.String |
getShortUrl(android.content.Context context,
LinkProperties linkProperties) |
java.lang.String |
getTitle()
Get a title for the content referred by this object
|
java.lang.String |
getType()
Get a title for the content referred by this object
|
boolean |
isPublicallyIndexable()
Specifies whether the contents referred by this object is publically indexable
|
void |
registerView()
Mark the content referred by this object as viewed.
|
void |
registerView(BranchUniversalObject.RegisterViewStatusListener callback)
Mark the content referred by this object as viewed.
|
BranchUniversalObject |
setCanonicalIdentifier(java.lang.String canonicalIdentifier)
Set the canonical identifier for this BranchUniversalObject.
|
BranchUniversalObject |
setCanonicalUrl(java.lang.String canonicalUrl)
Canonical url for the content referred.
|
BranchUniversalObject |
setContentDescription(java.lang.String description)
Set description for the content for the content referred by this object
|
BranchUniversalObject |
setContentExpiration(java.util.Date expirationDate)
Set the content expiration time.
|
BranchUniversalObject |
setContentImageUrl(java.lang.String imageUrl)
Set the url to any image associated with this content.
|
BranchUniversalObject |
setContentIndexingMode(BranchUniversalObject.CONTENT_INDEX_MODE indexMode)
Set the indexing mode for the content referred in this object
|
BranchUniversalObject |
setContentType(java.lang.String type)
Sets the content type for this Object
|
BranchUniversalObject |
setTitle(java.lang.String title)
Set a title for the content referred by this object
|
void |
showShareSheet(android.app.Activity activity,
LinkProperties linkProperties,
ShareSheetStyle style,
Branch.BranchLinkShareListener callback) |
void |
showShareSheet(android.app.Activity activity,
LinkProperties linkProperties,
ShareSheetStyle style,
Branch.BranchLinkShareListener callback,
Branch.IChannelProperties channelProperties) |
void |
writeToParcel(android.os.Parcel dest,
int flags) |
public BranchUniversalObject()
Create a BranchUniversalObject with the given content.
public BranchUniversalObject setCanonicalIdentifier(java.lang.String canonicalIdentifier)
Set the canonical identifier for this BranchUniversalObject. Canonical identifier is normally the canonical path for your content in the application or web
canonicalIdentifier - A String with value for the canonical identifierpublic BranchUniversalObject setCanonicalUrl(java.lang.String canonicalUrl)
Canonical url for the content referred. This would be the corresponding website URL.
canonicalUrl - A String with value for the canonical urlpublic BranchUniversalObject setTitle(java.lang.String title)
Set a title for the content referred by this object
title - A String with value of for the content titlepublic BranchUniversalObject setContentDescription(java.lang.String description)
description - A String with value for the description of the content referred by this objectpublic BranchUniversalObject setContentImageUrl(java.lang.String imageUrl)
imageUrl - A String specifying a url to an image associated with content referred by this objectpublic BranchUniversalObject addContentMetadata(java.util.HashMap<java.lang.String,java.lang.String> metadata)
Adds the the given set of key value pairs to the metadata associated with this content. These key values are passed to another user on deep linking.
metadata - A HashMap with String key value pairspublic BranchUniversalObject addContentMetadata(java.lang.String key, java.lang.String value)
Adds the the given set of key value pair to the metadata associated with this content. These key value is passed to another user on deep linking.
key - A String value for metadata keyvalue - A String value for metadata valuepublic BranchUniversalObject setContentType(java.lang.String type)
Sets the content type for this Object
type - String with value for the mime type of the content referredpublic BranchUniversalObject setContentIndexingMode(BranchUniversalObject.CONTENT_INDEX_MODE indexMode)
Set the indexing mode for the content referred in this object
indexMode - BranchUniversalObject.CONTENT_INDEX_MODE value for the content referredpublic BranchUniversalObject addKeyWords(java.util.ArrayList<java.lang.String> keywords)
Adds any keywords associated with the content referred
keywords - An ArrayList of String valuespublic BranchUniversalObject addKeyWord(java.lang.String keyword)
Add a keyword associated with the content referred
keyword - AString with value for keywordpublic BranchUniversalObject setContentExpiration(java.util.Date expirationDate)
Set the content expiration time.
expirationDate - A Date value representing the expiration date.public boolean isPublicallyIndexable()
Specifies whether the contents referred by this object is publically indexable
Boolean whose value is set to true if index mode is publicpublic java.util.HashMap<java.lang.String,java.lang.String> getMetadata()
Get the meta data provided for the content referred bt this object
HashMap containing metadata for the provided for this BranchUniversalObjectpublic long getExpirationTime()
Get expiry date for the content and any associated links. Represented as epoch milli second
Long with content expiration time in epoch millisecondspublic java.lang.String getCanonicalIdentifier()
Get the canonical identifier for this BranchUniversalObject
String with value for the canonical identifierpublic java.lang.String getCanonicalUrl()
Get the canonical url for this BranchUniversalObject
String with value for the canonical urlpublic java.lang.String getDescription()
String with value for the description of the content referred by this objectpublic java.lang.String getImageUrl()
String specifying a url to an image associated with content referred by this objectpublic java.lang.String getTitle()
Get a title for the content referred by this object
String with value of for the content titlepublic java.lang.String getType()
Get a title for the content referred by this object
String with value of for the content titlepublic org.json.JSONArray getKeywordsJsonArray()
BranchUniversalObjectJSONArray with keywords associated with this BranchUniversalObjectpublic java.util.ArrayList<java.lang.String> getKeywords()
BranchUniversalObjectArrayList with keywords associated with this BranchUniversalObjectpublic void registerView()
public void registerView(BranchUniversalObject.RegisterViewStatusListener callback)
callback - An instance of BranchUniversalObject.RegisterViewStatusListener to listen to results of the operationpublic java.lang.String getShortUrl(android.content.Context context,
LinkProperties linkProperties)
public void generateShortUrl(android.content.Context context,
LinkProperties linkProperties,
Branch.BranchLinkCreateListener callback)
public void showShareSheet(android.app.Activity activity,
LinkProperties linkProperties,
ShareSheetStyle style,
Branch.BranchLinkShareListener callback)
public void showShareSheet(android.app.Activity activity,
LinkProperties linkProperties,
ShareSheetStyle style,
Branch.BranchLinkShareListener callback,
Branch.IChannelProperties channelProperties)
public static BranchUniversalObject getReferredBranchUniversalObject()
BranchUniversalObject associated with the latest deep linking. This should retrieve the
exact object used for creating the deep link. This should be called only after initialising Branch Session.BranchUniversalObject used to create the deep link that started the this app session.
Null is returned if this session is not started by Branch link clickpublic static BranchUniversalObject createInstance(org.json.JSONObject jsonObject)
JSONObject.jsonObject - JSONObject to create the BranchUniversalObjectBranchUniversalObject corresponding to the Json data passed inpublic org.json.JSONObject convertToJson()
JSONObject which represent this BUOpublic int describeContents()
describeContents in interface android.os.Parcelablepublic void writeToParcel(android.os.Parcel dest,
int flags)
writeToParcel in interface android.os.Parcelable