Android SDK 4.x For Experience Cloud Solutions
Android SDK 4.x For Experience Cloud Solutions
Android SDK 4.x For Experience Cloud Solutions
Release Notes....................................................................................................................5
Getting Started.................................................................................................................7
Before You Start..................................................................................................................................................................7
Core Implementation and Lifecycle............................................................................................................................9
Processing Rules and Context Data..........................................................................................................................11
Migrating to the Android 4.x Library........................................................................................................................12
Configuration..................................................................................................................17
ADBMobile JSON Config...............................................................................................................................................17
Override the ADBMobile JSON Config Path....................................................................................................................................26
Hit Batching.......................................................................................................................................................................26
Configuration Methods.................................................................................................................................................26
Lifecycle Metrics.............................................................................................................33
Analytics..........................................................................................................................38
Track App States..............................................................................................................................................................38
Track App Actions...........................................................................................................................................................40
Track App Crashes...........................................................................................................................................................41
Timed Actions...................................................................................................................................................................44
Visitor Lifetime Value.....................................................................................................................................................45
Products Variable............................................................................................................................................................46
Products Variable with Merchandising eVars and Product-Specific Events........................................................................47
Event Serialization...........................................................................................................................................................48
Video Analytics.................................................................................................................................................................48
Postbacks...........................................................................................................................................................................53
Last updated 6/4/2019 Android SDK 4.x for Experience Cloud Solutions
Contents
Postbacks Example...................................................................................................................................................................................54
PII Postbacks...............................................................................................................................................................................................54
Analytics Methods...........................................................................................................................................................55
Acquisition......................................................................................................................59
Mobile App Acquisition................................................................................................................................................59
Acquisition Methods......................................................................................................................................................61
Tracking Deep Links.......................................................................................................................................................61
Tracking Third-Party Deferred Deep Links.......................................................................................................................................62
Messaging.......................................................................................................................71
In-App Messaging...........................................................................................................................................................71
Troubleshooting In-App Messaging..................................................................................................................................................73
Push Messaging...............................................................................................................................................................75
Implement Push Messaging with Deep Linking............................................................................................................................77
Receive Rich Push Notifications...........................................................................................................................................................78
Troubleshooting Push Messaging......................................................................................................................................................80
Location...........................................................................................................................82
Geo-Location and Points of Interest.........................................................................................................................82
Beacon tracking...............................................................................................................................................................84
Target..............................................................................................................................86
Target Configuration......................................................................................................................................................86
Target Methods................................................................................................................................................................86
Prefetch offer content in Android.............................................................................................................................91
Target Preview on Android..........................................................................................................................................96
Experience Cloud............................................................................................................97
Experience Cloud ID Configuration..........................................................................................................................97
Last updated 6/4/2019 Android SDK 4.x for Experience Cloud Solutions
Experience Cloud ID Service Methods.....................................................................................................................97
Experience Cloud Device Co-op..............................................................................................................................100
Audience Manager.......................................................................................................101
Audience Manager Configuration..........................................................................................................................101
Audience Manager Methods....................................................................................................................................101
Wearables.....................................................................................................................103
Android Wearables: Getting Started......................................................................................................................103
Android Wearables: Additional Notes...................................................................................................................106
PhoneGap Plug-in........................................................................................................114
PhoneGap Plug-in Methods......................................................................................................................................115
Last updated 6/4/2019 Android SDK 4.x for Experience Cloud Solutions
Release Notes 5
Release Notes
Release notes and known issues for Android SDK 4.x for Experience Cloud Solutions.
Important: As of September 2018, we released a new, major version of the SDK. These new Adobe Experience Platform
Mobile SDKs are configurable through Experience Platform Launch. To get started, go to Launch. To see what is in the
Experience Platform SDK repositories, go to Github: Adobe Experience Platform SDKs.
Mobile Services
Feature Description
Feature Description
For more information about the current and past release notes for all solutions, see Adobe Experience Cloud Release Notes.
Android SDK 4.x for Experience Cloud Solutions 6
Important: As of September 2018, we released a new, major version of the SDK. These new Adobe Experience Platform
Mobile SDKs are configurable through Experience Platform Launch. To get started, go to Launch. To see what is in the
Experience Platform SDK repositories, go to Github: Adobe Experience Platform SDKs.
Important: If you are using the Adobe Experience Platform Mobile SDKs with Adobe Launch, you must also install the
Adobe Analytics Mobile Services extension to use Adobe Mobile Services features such as in-app messaging, push notifications,
and Acquisition links. For more information see Adobe Analytics - Mobile Services.
• Version 4.6.0 or earlier supports Android 2.2(API 8) - Android 5.1.1 (API 22)
You can use HTTP only with version 4.6.0 and earlier.
• Version 4.6.1 or later supports Android 2.3(API 9) or later
• In version 4.2 and later, all hits are now sent using HTTP POST.
This has no impact on the data that is collected or reported, but you need to use a packet analyzer that supports inspecting
POST data to view hits, such as the Bloodhound 3.x for Mac.
Important: As of April 30, 2017, Adobe Bloodhound has been sunset. Starting on May 1, 2017, no additional enhancements
and no additional Engineering or Adobe Expert Care support will be provided.
• If you are upgrading from a previous version, see the 4.x Migration Guide.
Release Notes
For the latest information about Experience Cloud releases, see Experience Cloud Release Notes.
Getting Started 7
Getting Started
The following information helps you get started with the Android SDK for Experience Cloud Solutions:
Important: As of September 2018, we released a new, major version of the SDK. These new Adobe Experience Platform
Mobile SDKs are configurable through Experience Platform Launch. To get started, go to Launch. To see what is in the
Experience Platform SDK repositories, go to Github: Adobe Experience Platform SDKs.
Before configuring a report suite and collecting Android app data, complete the following prerequisite tasks:
This section contains the following information:
• Role-Specific Tasks
• Log in to the Adobe Mobile Services UI
• Create a Report Suite
• Download the SDK
Role-Specific Tasks
Analytics administrators and app developers must complete the following tasks:
Analytics administrators
1. Complete one of the sections in Log in to the Adobe Mobile Services UI.
2. Create an Analytics account for each app developer.
App developers now have access to view the report suite(s) that you created.
Important: To create a new report suite and download the SDKs, you must be an Analytics Administrator.
App developers
1. Ensure that your Analytics administrator has completed the steps in the Analytics Administrators section in Role-Specific
Tasks.
2. Verify that your Analytics administrator has completed one of the sections in Log in to the Adobe Mobile Services UI.
3. After the report suite has been configured, complete steps in Download the SDK.
For more information about roles and permissions, see Roles and Permissions.
Getting Started 8
You can log in to the Adobe Mobile Services UI in one of the following ways:
• Experience Cloud
Sign in to the Experience Cloud with your Adobe ID. This method assumes that your company has been provisioned in the
Experience Cloud, and you have linked your Analytics account.
Tip: If you are unsure whether your company has been provisioned in the Experience Cloud, use your existing Adobe
Analytics account.
• Adobe Analytics
Click Sign in with Analytics and enter your Analytics company name, your username, and your password.
1. Log in to the Mobile Services UI and open your app in one of the following ways:
Attention: A config file for your app is automatically included in the SDK download, so you do not need to download that
file separately. However, if you already downloaded the SDK, and you want to get updated settings, download the config
file again.
Getting Started 9
If you are using Android Studio, you can also add the following to your app's build.gradle file:
compile 'com.adobe.mobile:adobeMobileLibrary:4.13.7'
• Replace the version number in the code sample with the appropriate version of the Android SDKs.
• Download the config file and include it in your project.
This information helps you implement the Android library and collect lifecycle metrics, such as launches, upgrades, sessions,
engaged users, and so on.
This topic contains the following information:
Important: To download the SDK, you must use Android 2.2 or later.
1. Complete the steps in the following sections to set up a development report suite and download a pre-populated version of
the configuration file:
2. Download, unzip the [Your_App_Name_]AdobeMobileLibrary-4.*-Android.zip file, and verify that the following
software components exist:
• adobeMobileLibrary.jar
This is the library that will be used with Android devices and simulators.
• ADBMobileConfig.json
This is the SDK configuration file that is customized for your app.
Important: If you download the SDK outside the Adobe Mobile services UI, the ADBMobileConfig.json file must be
manually configured. If you are new to Analytics and the Mobile SDK, and you want to set up a development report suite
and download a pre-populated version of the configuration file, see Before You Start.
Add the SDK and Config File to your IntelliJ IDEA or Eclipse Project
IntelliJ IDEA Project
Eclipse Project
• INTERNET
• ACCESS_NETWORK_STATE
To add these permissions, add the following lines to your AndroidManifest.xml file, which is located in the application
project directory:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Important: You must add these calls to every activity to ensure accurate crash reporting. For more information, see Track
App Crashes.
Getting Started 11
To include additional data with lifecycle metric calls, pass an additional parameter to collectLifecycleData that contains
context data:
@Override
public void onResume() {
HashMap<String, Object> contextData = new HashMap<String, Object>();
contextData.put("myapp.category", "Game");
Config.collectLifecycleData(this, contextData);
}
Additional context data values that are sent with collectLifecycleData must be mapped to custom variables in Adobe
Mobile services:
Other lifecycle metrics are collected automatically. For more information, see Lifecycle Metrics.
What to do next
Complete the following tasks:
Processing rules are used to copy the data that you send in context data variables to evars, props, and other variables for reporting.
For more information, see the following content:
• Group your context data variables by using namespaces, because it helps you maintain a logical ordering. For example, to
collect information about a product, you might define the following variables:
"product.type":"hat"
"product.team":"mariners"
"product.color":"blue"
• Context data variables are sorted alphabetically in the processing rules interface, which allows you to quickly see which variables
are in the same namespace.
Getting Started 12
Avoid naming context data keys by using the evar or prop number:
"eVar1":"jimbo"
This might make it slightly easier when you complete the one-time mapping in processing rules, but you lose readability during
debugging and future code updates, which can be more difficult. Instead, we strongly recommend that you use descriptive
names for keys and values:
"username":"jimbo"
• Context data variables that define incrementor events can have the event as the key, and the amount to increment as the value:
"levels completed":"6"
Tip: Adobe reserves the namespace "a.". To avoid collisions, the only other requirement is that context data variables are
unique in your login company.
This information helps you migrate from the 3.x or 2.x version of the Android library to version 4.x.
Important: The SDK uses SharedPreferences to store data that is needed to calculate unique users, lifecycle metrics,
and other data related to core SDK functionality. If you modify or remove the values in SharedPreferences that are
expected by the SDK, unexpected behavior might result in the form of data inconsistencies.
In the version 4.x library, the public methods are consolidated into one header. Also, all functionality is now accessible through
class level methods, so you do not have to keep track of pointers, instances, or singletons.
Tip: Values that you assigned directly to variables should be added to the data HashMap.
1. Move the value that is set for the variable in the first column to the variable in the second column.
2. Remove the old configuration variable from your code.
Move the value from the first column to the variable in the second column.
setOfflineHitLimit
"batchLimit"
reportSuiteIDs
"rsids"
trackingServer
"server"
charSet
"charset"
Getting Started 14
ssl
"ssl"
linkTrackVars
Remove, no longer used.
linkTrackEvents
Remove, no longer used.
Move the value from the first column to the variable in the second column.
offlineLimit
"batchLimit"
account
"rsids"
trackingServer
"server", remove the "http://" prefix. The protocol prefix is added automatically based on the
"ssl" setting.
trackingServerSecure
Remove. For secure connections, define "server" and then enable "ssl".
charSet
"charset"
currencyCode
"currency"
ssl
"ssl"
linkTrackVars
Remove, no longer used.
linkTrackEvents
Remove, no longer used.
timestamp
Remove, no longer configurable.
dc
Remove, no longer used.
userAgent
Remove, no longer configurable.
dynamicVariablePrefix
Remove, no longer used.
Getting Started 15
usePlugins
Remove, no longer used.
These states are similar to pages on a website, and trackState calls increment page views.
• trackAction actions, such as logons, banner taps, feed subscriptions, and so on that occur in your app and that
you want to measure.
The contextData parameter for both of these methods is a HashMap<String, Object>, which contains the name-value
pairs that are sent as context data.
In version 4, you can no longer assign variables such as events, eVars, props, heirs, and lists directly in your app. The SDK now
uses context data and processing rules to map your app data to Analytics variables for reporting.
Values that you were assigning directly to variables should be added to the data HashMap. This means that calls to setProp,
setEvar, and assignments to persistent context data should be removed and the values be added to the data parameter.
Data that you were setting on the measurement object, including the variables listed above, should be added to the data HashMap.
The only data that is sent with a trackState or trackAction call is the payload in the data parameter.
• track (trackAction)
• trackLinkURL (trackAction)
Migrating from version 2.x
• track (trackState)
• trackLink (trackAction)
Custom Visitor ID
Replace the visitorID variable with a call to setUserIdentifier.
Offline Tracking
Offline tracking is enabled in ADBMobileConfig.json, and all other offline configuration is done automatically.
Version 3.x
• setOnline
• setOffline
Version 2.x
• forceOffline
• forceOnline
Products Variable
For more information about the products variable, see Products Variable.
Important: As of April 30, 2017, Adobe Bloodhound has been sunset. Starting on May 1, 2017, no additional enhancements
and no additional Engineering or Adobe Expert Care support will be provided.
Configuration 17
Configuration
The following information helps you configure the Android SDK, including JSON configuration, hit batching, and SDK methods:
Additional Information
Looking for information and documentation related to the Adobe Experience Platform Mobile SDK? Click here for our latest
documentation.
Important: As of September 2018, we released a new, major version of the SDK. These new Adobe Experience Platform
Mobile SDKs are configurable through Experience Platform Launch. To get started, go to Launch. To see what is in the
Experience Platform SDK repositories, go to Github: Adobe Experience Platform SDKs.
Tip: In Android, the ADBMobileConfig.json file must be placed in the assets folder.
• server, which is the acquisition server that is checked at the initial launch
for an acquisition referrer.
• appid, which is the generated ID that uniquely identifies this app on the
acquisition server.
If this section is missing, enable Mobile App acquisition and download the
SDK configuration file again. For more information, see the referrerTimeout
row in this table.
4.8.0
analyticsForwardingEnabled The default value is false.
4.6
backdateSessionInfo Enables/disables the ability for the Adobe SDK to backdate session info hits.
Configuration 18
The SDK returns to its pre-4.1 behavior of lumping the session information
for the previous session with the first hit of the subsequent session. The
Adobe SDK also attaches the session info to the current lifecycle, which
avoids the creation of an inflated visit. Because inflated visits are no longer
created, an immediate drop in visit counts occurs.
• If you do not provide a value, the default value is true, and hits are enabled.
When the hits are enabled, the Adobe SDK backdates the session info hit to
1 second after the final hit in the previous session. This means that crash
and session data will correlate with the correct date on which they occurred.
One side effect is that the SDK might create a visit for the backdated hit.
4.1
batchLimit Threshold for number of hits to be sent in consecutive calls.
For example, if batchLimit is set to 10, each hit before the 10th hit will be
stored in the queue. When the 10th hit comes in, all 10 hits will be sent
consecutively.
4.0
charset Defines the character set that you are using for the data that is sent to Analytics.
The charset is used to convert incoming data into UTF-8 for storage and
reporting.
4.0
clientCode
Important: This variable is required by Target.
4.16.1
coopUnsafe • The Boolean property of the marketingCloud object that, when set to
true, will cause device to be opted-out of the Experience Cloud's Device
Co-op.
Configuration 19
For Device Co-op members who require this value set to true, you need to
work with the Co-op team to request a blacklist flag on your Device Co-op
account. There is no self-service path to enabling these flags.
environmentId 4.14
The ID of the environment you want to use.
You can specify a valid ID (environmentId=8), and if environmentId is
not included, the default Production environment is used.
4.0
lifecycleTimeout Default value is 300 seconds.
Specifies the length of time, in seconds, that must elapse between the time the
app launches but before the launch is considered to be a new session. This
timeout also applies when your application is sent to the background and
reactivated.
The time that your app spends in the background is not included in the session
length.
4.2
messages Generated automatically by Adobe Mobile services, defines the settings for
in-app messaging. For more information, see the Messages Description section
below.
4.0
offlineEnabled When enabled, hits are queued while the device is offline and sent later when
the device is online. Your report suite must be timestamp-enabled to use offline
tracking.
4.3
org Specifies the Experience Cloud org ID for the ID service.
4.0
poi Each point of interest (POI) array holds the POI name, latitude, longitude,
and radius in meters for the area of the point. The POI name can be any string.
Tip: Starting in version 4.2, POIs are defined in the Adobe Mobile
interface and synchronized dynamically to the app configuration file.
This synchronization requires the analytics.poi setting:
“analytics.poi”:
“https://assets.adobedtm.com/…/yourfile.json”,
4.6
postback Here is the definition for the "callback" message template:
"payload": {
"templateurl": "", // required - will be token-expanded
prior to being sent
"templatebody": "", // optional - if this length > 0 POST
will be used as transport method. This is a base64 encoded
blob, which will be decoded and token-expanded prior to
being sent.
"contenttype": "", // optional - if this is length > 0
and POST type is selected this will be set as the
Content-Type header. if this is not supplied for a POST
request, the default will be
"application/x-www-form-urlencoded"
"timeout": 0 // optional - number of seconds to wait
before timing out. Default is 2.
}
The payload object in the code is a sample payload for a message definition
that goes in ADBMobileConfig.json.
• Postbacks (Android)
• Postbacks (iOS)
Configuration 21
If your report suite is not timestamp-enabled, hits are discarded until the
privacy status changes to opt in.
This only sets the initial value. If this value is set or changed in code, the new
value is used until it is changed again, or when the app is uninstalled and
reinstalled.
4.1
referrerTimeout Number of seconds the SDK waits for acquisition referrer data on the initial
launch before timing out. If you are using acquisition, we recommend a
5-second timeout.
If the variable is set to 0 or is not included, the SDK does not wait for
acquisition data, and acquisition metrics are not tracked.
4.2
remotes Configured automatically and defines the Adobe-hosted endpoints for dynamic
configuration files. The last update time of each configuration file is checked
against the current version at each launch, and the updates are downloaded
and saved.
4.0
rsids
Important: This variable is required by Analytics.
One or more report suites to receive Analytics data. Multiple report suite IDs
should be comma-separated with no space between.
"rsids" : "rsid"
"rsids" : "rsid1,rsid2"
server 4.0
Important: This variable is required by Analytics and/or Audience
Management.
ssl 4.0
The default value is false.
The payload object in the code is an sample payload for a message definition
that goes in ADBMobileConfig.json.
• Postbacks (Android)
• Postbacks (iOS)
timeout 4.0
Determines how long Target waits for a response.
"analyticsForwardingEnabled": false
},
"acquisition": {
"server": "c00.adobe.com",
"appid": "10a77a60192fbb628376e1b1daeeb65debf934e2c807e067ceb2963a41b165ee"
},
"analytics": {
"rsids": "coolApp",
"server": "my.CoolApp.com",
"ssl": false,
"offlineEnabled": true,
"charset": "UTF-8",
"lifecycleTimeout": 300,
"privacyDefault": "optedin",
"batchLimit": 0,
"referrerTimeout": 5,
"poi": [
["san francisco",37.757144,-122.44812,7000],
["santa cruz",36.972935,-122.01725,600]
]
},
"messages": [
{
"messageId": "cb426565-a563-497a-a889-9dbeb451f8ae",
"template": "fullscreen",
"payload": {
"html": "<!DOCTYPE html><html><head><meta charset=\"utf-8\"
/><title></title><style></style></head><body><iframe src=\"http://www.adobe.com/\"
frameborder=\"0\"></iframe></body></html>"
},
"showOffline": false,
"showRule": "always",
"endDate": 2524730400,
"startDate": 0,
"audiences": [],
"triggers": [
{
"key": "pev2",
"matches": "eq",
"values": [
"AMACTION:custom"
]
}
]
}
],
"remotes": {
"analytics.poi":
"https://assets.adobedtm.com/staging/42a6fc9b77cd9f29082cf19b787bae75b7d1f9ca/scripts/satellite-53e0faadc2f9ed92bc00003b.json",
"messages":
"https://assets.adobedtm.com/staging/42a6fc9b77cd9f29082cf19b787bae75b7d1f9ca/scripts/satellite-53e0f9e2c2f9ed92bc000032.json"
}
}
Messages description
The messages node is generated automatically by Adobe Mobile services and typically does not need to be manually changed.
The following description is provided for troubleshooting purposes:
• "messageId"
• Generated ID, required
• "template"
• "alert", "fullscreen", or "local"
Configuration 24
• required
• "showOffline"
• true or false
• default is false
• "showRule"
• "always", "once", or "untilClick"
• required
• "endDate"
• number of seconds since Jan 1, 1970
• default is 2524730400
• "startDate"
• number of seconds since Jan 1, 1970
• default is 0
• "payload"
• "html"
• • fullscreen template only, required
• html defining the message
• "image"
• fullscreen only, optional
• url to the image to be used for a fullscreen image
• "altImage"
• fullscreen only, optional
• name of the bundled image to use if the url specified in
• image
• is unreachable
• "title"
• fullscreen and alert, required
• title text for a fullscreen or alert message
• "content"
• alert and local notification, required
• sub-text for an alert message, or notification text for a local notification message
• "confirm"
• alert, optional
• text used in the confirm button
• "cancel"
Configuration 25
• alert, required
• text used in the cancel button
• "url"
• alert, optional
• url action to load if the confirm button is clicked
• "wait"
• local notification, required
• amount of time to wait (in seconds) to post the local notification after matching its criteria
• "audiences"
• array of objects that defines how the message should be shown
• "key"
• variable name to look for in the hit, required
• "matches"
• type of matcher used when doing the comparison
• • eq = equals
• ne = does not equal
• co = contains
• nc = does not contain
• sw = starts with
• ew = ends with
• ex = exists
• nx = does not exist
• lt = less than
• le = less than or equals
• gt = greater than
• ge = greater than or equals
• "values"
• an array of values used to match against the value of the variable named in
key
matches
• "triggers"
• same as audiences, but this is the action instead of the audience
Configuration 26
• "key"
• "matches"
• "values"
Calling this method with a different path causes a one-time override of the configuration file until the application is closed.
try {
InputStream configInput = getAssets().open("ExampleJSONFile.json");
Config.overrideConfigStream(configInput);
} catch (IOException ex) {
// do something with the exception if needed
}
Hit Batching
Hit batching allows applications to hold hits from being sent until the number of hits in the queue have exceeded the configured
limit.
: To use hit batching, you must enable offline tracking.
To enable hit batching, update your ADBMobileConfig.json and specify a value for batchLimit:
"analytics": {
"batchLimit": 5,
...
}
When the value is set to a number greater than 0, the SDK queues the number of hits equal to the batchLimit value. After this
threshold is passed, all hits in the queue are sent.
Configuration Methods
Here is the list of methods that are provided by the Android library.
This section contains the following information:
• Initial Configuration
• SDK Settings (Config Class)
Configuration 27
Initial Configuration
The following method must be called once in the onCreate method of your main activity:
Method Description
setContext
For example:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Config.setContext(this.getApplicationContext());
}
Method Description
registerAdobeDataCallback
Registers an object that implements the AdobeDataCallback interface. The overwritten "call"
method will be invoked with a Config.MobileDataEvent value and the associated data in
a Map<String, Object> for the triggering event. For more details about which events will
trigger this callback, see MobileDataEvent Enum.
Syntax:
public static void registerAdobeDataCallback(final AdobeDataCallback
callback);
Example:
Config.registerAdobeDataCallback(new Config.AdobeDataCallback() {
@Override
public void call(Config.MobileDataEvent event, Map<String, Object>
contextData) {
// handle each event type accordingly
if (event ==
Config.MobileDataEvent.MOBILE_EVENT_ACQUISITION_INSTALL) {
// do something with acquisition data found in contextData
parameter
HashMap<String, Object> acquisitionData = new
HashMap<String, Object>(contextData);
...
}
}
});
getVersion
Returns the current version of the Adobe Mobile library.
Syntax:
public static String getVersion();
Example:
String libraryVersion = Config.getVersion();
getPrivacyStatus
Returns the enum representation of the privacy status for current user.
Configuration 28
Method Description
Here are the privacy status values:
• MOBILE_PRIVACY_STATUS_OPT_IN, where the hits are sent immediately.
• MOBILE_PRIVACY_STATUS_OPT_OUT, where the its are discarded.
• MOBILE_PRIVACY_STATUS_UNKNOWN, where if your report suite is timestamp enabled, hits
are saved until the privacy status changes to opt-in (hits are sent) or opt-out (hits are
discarded).
If your report suite is not timestamp enabled, hits are discarded until the privacy status changes
to opt in.
Syntax:
public static MobilePrivacyStatus getPrivacyStatus();
Example:
MobilePrivacyStatus privacyStatus = Config.getPrivacyStatus();
setPrivacyStatus
Sets the privacy status for the current user to status.
You can set the privacy status to one of the following values:
• MOBILE_PRIVACY_STATUS_OPT_IN, where the hits are sent immediately.
These hits are sent immediately.
• MOBILE_PRIVACY_STATUS_OPT_OUT, where the its are discarded.
These hits are discarded.
• MOBILE_PRIVACY_STATUS_UNKNOWN, where if your report suite is timestamp enabled, hits
are saved until the privacy status changes to opt-in (hits are sent) or opt-out (hits are
discarded).
If your report suite is not timestamp enabled, hits are discarded until the privacy status changes
to opt in.
Syntax:
public static void setPrivacyStatus(MobilePrivacyStatus status);
Example:
Config.setPrivacyStatus(MobilePrivacyStatus.MOBILE_PRIVACY_STATUS_OPT_IN);
getLifetimeValue
Returns the lifetime value of the current user.
Syntax:
public static BigDecimal getLifetimeValue();
Example:
BigDecimal currentLifetimeValue = Config.getLifetimeValue();
Configuration 29
Method Description
getUserIdentifier
If a custom identifier has been set, the custom user identifier is returned. If a custom identifier
has not been set, it returns null.
Tip: If your app upgrades from the Experience Cloud 3.x to the 4.x SDK, the previous
custom or automatically generated visitor ID is retrieved and stored as the custom user
identifier. This preserves visitor data between SDK upgrades. For new installations on the
4.x SDK, until it is set, the user identifier is null.
Syntax:
public static String getUserIdentifier();
Example:
String userId = Config.getUserIdentifier();
setUserIdentifier
Sets the user identifier to identifier.
Syntax:
public static void setUserIdentifer(String identifier);
Example:
Config.setUserIdentifier("billybob");
getDebugLogging
Returns the current debug logging preference.
Syntax:
public static Boolean getDebugLogging();
Example:
Boolean debugging = Config.getDebugLogging();
setDebugLogging
Sets the debug logging preference to debugLogging.
Syntax:
public static void setDebugLogging(Boolean debugLogging);
Example:
Config.setDebugLogging(true);
collectLifecycleData
Indicates to the SDK that lifecycle data should be collected for use across all solutions in the
SDK. For more information, see Lifecycle Metrics.
Syntax:
public static void collectLifecycleData(final Activity activity, final
Map<String, Object> contextData);
Example:
Configuration 30
Method Description
Without extra context data:
@Override
protected void onResume() {
super.onResume();
Config.collectLifecycleData(this);
}
contextData.put("myapp.category", "Game");
Config.collectLifecycleData(this, contextData);
}
collectLifecycleData (Activity
(Version 4.2 or later) Indicates to the SDK that lifecycle data should be collected for use across
activity)
all solutions in the SDK. For more information, see Lifecycle Metrics.
Syntax:
public static void collectLifecycleData(final Activity activity);
Example:
@Override
protected void onResume() {
super.onResume();
// assumes being called in an Activity class
Config.collectLifecycleData(this);
}
pauseCollectingLifecycleData
Indicates to the SDK that your app is paused, so that lifecycle metrics are calculated correctly.
For example, onPause collects a timestamp to determine the previous session length. This also
sets a flag so that lifecycle knows that the app did not crash. For more information, see Lifecycle
Metrics.
Syntax:
public static void pauseCollectingLifecycleData();
Example:
@Override
protected void onPause() {
super.onPause();
Config.pauseCollectingLifecycleData();
}
setSmallIconResourceId(int
(Version 4.2 or later) Sets the small icon that will be used for notifications that were created
resourceId)
by the SDK. This icon will appear in the status bar and will be the secondary image that is
displayed when the user sees the complete notification in the notification center.
Syntax:
public static void setSmallIconResourceId(final int resourceId);
Example:
Config.setSmallIconResourceId(R.drawable.appIcon);
Configuration 31
Method Description
setLargeIconResourceId(int
(Version 4.2 or later) Sets the large icon that will be used for notifications that were created
resourceId)
by the SDK. This icon will be the primary image that is displayed when the user sees the complete
notification in the notification center.
Syntax:
public static void setLargeIconResourceId(final int resourceId);
Example:
Config.setLargeIconResourceId(R.drawable.appIcon);
overrideConfigStream(InputStream
(Version 4.2 or later) Allows you to load a different ADBMobile JSON config file when the
configInput)
application starts. The different configuration is used until the application is closed.
Syntax:
public static void overrideConfigStream(final InputStream configInput);
Example:
try {
InputStream configInput = getAssets().open("ExampleJSONFile.json");
Config.overrideConfigStream(configInput);
} catch (IOException ex) {
// do something with the exception if needed
}
setPushIdentifier
Sets the device token for push notifications.
Syntax:
public static void setPushIdentifier(final String registrationId);
Example:
...
// note: the code to retreive the push token must run in the background
InstanceID instanceID = InstanceID.getInstance(getApplicationContext());
String token = instanceID.getToken("835015092242",
GoogleCloudMessaging.INSTANCE_ID_SCOPE, null);
Config.setPushIdentifier(token);
...
submitAdvertisingIdentifierTask
Provides a Callable to the SDK that returns the string of the Advertising Identifier that is
returned from Google Play Services.
The SDK runs this task on a background thread and sets an internal variable for the Advertising
Identifier that is based on the value returned from the Callable.
Important: If you want to use the Advertising Identifier in Acquisition or Lifecycle, call
it before calling Config.collectLifecycleData.
Syntax:
public static void submitAdvertisingIdentifierTask(final
Callable<String> task);
Configuration 32
Method Description
Example:
@Override
public void onResume() {
super.onResume();
try {
idInfo =
AdvertisingIdClient.getAdvertisingIdInfo(appContext);
if (idInfo != null) {
adid = idInfo.getId();
}
} catch (Exception ex) {
Log.e("Error", ex.getLocalizedMessage());
}
return adid;
}
};
Config.submitAdvertisingIdentifierTask(task);
Config.collectLifecycleData(this);
}
AdobeDataCallback Interface
public interface AdobeDataCallback {
void call(MobileDataEvent event, Map<String, Object> contextData);
}
MobileDataEvent Enum
public enum MobileDataEvent {
MobileDataEvent.MOBILE_EVENT_LIFECYCLE, // triggers on a lifecycle hit
MobileDataEvent.MOBILE_EVENT_ACQUISITION_INSTALL, // triggers on a app install that has
acquisition data
MobileDataEvent.MOBILE_EVENT_ACQUISITION_LAUNCH // triggers on launch when the device
previously installed via acquisition
}
Lifecycle Metrics 33
Lifecycle Metrics
Here are the metrics and dimensions that can be measured automatically by the mobile library, after lifecycle is implemented,
and a link to troubleshoot Lifecycle data.
Important: As of September 2018, we released a new, major version of the SDK. These new Adobe Experience Platform
Mobile SDKs are configurable through Experience Platform Launch. To get started, go to Launch. To see what is in the
Experience Platform SDK repositories, go to Github: Adobe Experience Platform SDKs.
For Analytics, the context data that is sent with each lifecycle tracking call is automatically captured in and reported on by using
the metric or dimension listed in the first column, with the exceptions noted in the Description column.
Metrics
First Launches a.InstallEvent c_a_InstallEvent Triggered at the first run after installation or
re-installation.
Upgrades a.UpgradeEvent c_a_UpgradeEvent Triggered at the first run after an upgrade or when
the version number changes.
Dimensions
App ID a.AppID c_a_AppID Stores the application name and version in the
following format:
[AppName] [BundleVersion]
Launch Number a.Launches c_a_Launches Number of times the application was launched or
brought out of the background.
Days since first use a.DaysSinceFirstUse c_a_DaysSinceFirstUse Number of days since the first run.
Lifecycle Metrics 35
Days since last use a.DaysSinceLastUse c_a_DaysSinceLastUse Number of days since the last use.
Hour of Day a.HourOfDay c_a_HourOfDay Measures the hour that the app was launched.
Day of Week a.DayOfWeek c_a_DayOfWeek Number of the day in a week when the app was
launched.
Days since last a.DaysSinceLastUpgrade c_a_DaysSinceLastUpgrade Number of days since the application version
upgrade number has changed.
Launches since last a.LaunchesSinceUpgrade c_a_LaunchesSinceUpgrade Number of launches since the application version
upgrade number has changed.
Carrier Name a.CarrierName c_a_CarrierName Stores the name of the mobile service provider as
provided by the device.
Metrics
Dimensions
Location (down to
a.loc.lat.a c_a_loc_lat_a Populated by trackLocation methods.
10 km)
a.loc.lon.a c_a_loc_lon_a
Location (down to
a.loc.lat.b c_a_loc_lat_b Populated by trackLocation methods.
100 m)
a.loc.lon.b c_a_loc_lon_b
Location (down to 1
a.loc.lat.c c_a_loc_lat_c Populated by trackLocation methods.
m)
a.loc.lon.c c_a_loc_lon_c
a.referrer.campaign.name c_a_referrer_campaign_name
Campaign Name of the campaign, also stored in the campaign
variable. Populated by Mobile App Acquisition.
Lifecycle Metrics 37
a.referrer.campaign.content c_a_referrer_campaign_content
Campaign Content The name or ID of the content that displayed the
link. Populated by Mobile App Acquisition.
a.referrer.campaign.medium c_a_referrer_campaign_medium
Campaign Medium Marketing medium, such as a banner or email.
Populated by Mobile App Acquisition.
a.referrer.campaign.source c_a_referrer_campaign_source
Campaign Source Original referrer, such as a newsletter or a social
media network. Populated by Mobile App
Acquisition.
a.referrer.campaign.term c_a_referrer_campaign_term
Campaign Term Paid keywords or other terms that you want to
track with this acquisition. Populated by Mobile
App Acquisition.
Analytics 38
Analytics
This information helps you use the Android SDK with Adobe Analytics.
Important: As of September 2018, we released a new, major version of the SDK. These new Adobe Experience Platform
Mobile SDKs are configurable through Experience Platform Launch. To get started, go to Launch. To see what is in the
Experience Platform SDK repositories, go to Github: Adobe Experience Platform SDKs.
Tip: The correct acronym for Experience Cloud Identifier is ECID. Although the SDKs still use MID, it is the old name.
The AID, which is also sometimes referred to as the Tracking Identifier, is generated by the SDK when the app is not configured
to use an MID. The value persists between launches and app upgrades in SharedPreferences. If the user deletes the app from
their device and then re-installs the app, or if the app developer clears out SharedPreferences, a new identifier is generated
by the SDK. This process results in a new user in Analytics reporting.
For users in an app that introduces Identity service support (MID), existing AID values are sent with Analytics hits, and the
Analytics hit contains an AID and an MID. For new users in an app with Identity service support, the Analytics requests contain
only an MID. For more information about identifying visitors, see Identifying Visitors.
Important: The VID and AID identifiers are only used by Analytics, and the MID identifier is used across multiple solutions.
Tracking States
1. Add the library to your project and implement lifecycle.
2. Import the library:
import com.adobe.mobile.*;
3. In the onCreate function, call trackState to send a hit for this state view:
@Override
public void onCreate(Bundle savedInstanceState) {
Analytics 39
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
The "State Name" is reported in the View State variable in Adobe Mobile services, and a view is recorded for each
trackState call. In other Analytics interfaces, View State is reported as Page Name, and state views is reported as page
views.
Context data values must be mapped to custom variables in Adobe Mobile services:
Adobe Mobile
The View States report.
Services
This report is based on the paths that the users took through your application. A sample path is Home >
Settings > Feed.
Adobe States can be viewed anywhere that Pages can be viewed, such as the Pages report, the Page Views report,
Analytics and the Path report.
Ad hoc States can be viewed anywhere Pages can be viewed by using the Page dimension, Page Views metric, Path
analytics reports.
Analytics 40
Actions are the events that occur in your Android app that you want to measure.
Each action has one or more corresponding metrics that are incremented each time the event occurs. For example, you might
send a trackAction call for each new subscription, each time an article is viewed, or each time a level is completed. Actions
are not tracked automatically, so you must call trackAction when an event that you want to track occurs, and map the action
to a custom event.
Tracking Actions
1. Add the library to your project and implement lifecycle.
2. Import the library:
import com.adobe.mobile.*;
3. When the action that you want to track occurs in your app, call trackAction to send a hit for this action:
Analytics.trackAction("myapp.ActionName", null);
4. In the Adobe Mobile Services UI, select your app and click Manage App Settings.
5. Click Manage Variables and Metrics and click the Custom Metrics tab.
6. Map the context data name that is defined in your code, for example, myapp.ActionName, to a custom event.
You can also set a prop to hold all action values by mapping a custom prop with a name like Custom Actions and setting the
value to a.action.
Analytics 41
Context data values must be mapped to custom variables in Adobe Mobile services:
Action Reporting
Interface Report
View the order in which actions occur in your app. You can also click Customize on any report to
view actions ranked, trended, or in a breakdown report or apply a filter to view actions for a specific
segment.
Ad hoc analytics
Custom Event report.
After an action is mapped to a custom event, you can view mobile events similar to all other Analytics
events.
This information helps you understand how crashes are tracked and the best practices to handle false crashes.
Prerequisite: App crashes are tracked as part of lifecycle metrics. Before you can track crashes, add the library to your project
and implement lifecycle.
When lifecycle metrics are implemented, a call is made to Config.collectLifecycleData in the OnResume method of each
activity. In the onPause method, a call is made to Config.pauseCollectingLifeCycleData.
Analytics 42
In the pauseCollectingLifeCycleData, a flag is set to indicate a graceful exit. When the app is launched again or resumed,
collectLifecycleData checks this flag. If the app did not exit successfully as determined by the flag status, an a.CrashEvent
context data is sent with the next call and a crash event is reported.
To ensure accurate crash reporting, you must call pauseCollectingLifeCycleData in the onPause method of each activity.
To understand why this is essential, here is an illustration of the Android activity lifecycle:
For more information about the Android activity lifecycle, see Activities.
This Android lifecycle illustration was created and shared by the Android Open Source Project and used according to terms in the
Creative Commons 2.5 Attribution License.
Analytics 43
1. If you are debugging by using an IDE, such as Android Studio, and launching the app again from the IDE while the app is
in the foreground causes a crash.
Tip: You can avoid this crash by backgrounding the app before launching again from the IDE.
2. If the last foreground Activity of your app is backgrounded and does not call Config.pauseCollectingLifecycleData();
in onPause, and your app is manually closed or killed by the OS, the next launch results in a crash.
Fragments have application lifecycle events that are similar to Activities. However, a Fragment cannot be active without being
attached to an Activity.
Important: You need to rely on the lifecycle events against which the containing activities can run your code. This will be
handled by the parent view of the Fragment.
Starting with API Level 14, Android allows global lifecycle callbacks for activities. For more information, see the Android
Developers Guide.
You can use these callbacks to ensure that all of your Activities correctly call collectLifecycleData() and
pauseCollectingLifecycleData(). You need to add this code only in your main Activity and any other Activity in which
your app may be launched:
import com.adobe.mobile.Config;
getApplication().registerActivityLifecycleCallbacks(new
Application.ActivityLifecycleCallbacks() {
@Override
public void onActivityResumed(Activity activity) {
Config.setContext(activity.getApplicationContext());
Config.collectLifecycleData(activity);
}
@Override
public void onActivityPaused(Activity activity) {
Config.pauseCollectingLifecycleData();
}
// the following methods aren't needed for our lifecycle purposes, but are required
to be implemented
// by the ActivityLifecycleCallbacks object
@Override
public void onActivityCreated(Activity activity, Bundle savedInstanceState) {}
@Override
public void onActivityStarted(Activity activity) {}
@Override
public void onActivityStopped(Activity activity) {}
@Override
public void onActivitySaveInstanceState(Activity activity, Bundle outState) {}
@Override
public void onActivityDestroyed(Activity activity) {}
Analytics 44
});
}
...
}
To send additional context data with your lifecycle call by using Config.collectLifecycleData(Activity activity,
Map<String, Object> contextData), you must override the onResume method for that Activity and ensure that you call
super.onResume() after manually calling collectLifecycleData.
@Override
protected void onResume() {
HashMap<String, Object> cdata = new HashMap<>();
cdata.put("someKey", "someValue");
Config.collectLifecycleData(this, cdata);
super.onResume();
}
Timed Actions
Timed actions allow you to measure the in-app time and total time between the start and the end of an action. The SDK calculates
the amount of time in each session and the total time across sessions that it will take for the action to be completed. You can
use timed actions to define segments and compare time to purchase, pass level, checkout flow, and so on.
The following metrics are reported for timed actions:
• Total # of seconds in the app between start and end (cross sessions)
• Total # of seconds between start and end (clock time)
An optional callback allows you to take additional action when the timed action completes:
• Run code and add any logic - optional custom logic based on duration results.
• Add context data before passing in durations.
• Cancel hit and durations not yet sent.
3. Call trackTimedActionStart and provide a timed action name and optional context data.
HashMap cdata = new HashMap<String, Object>();
cdata.put("ExperienceName", experience);
Analytics.trackTimedActionStart("TimeUntilPurchase", cdata);
4. (Optional) At any point, you can call trackTimedActionUpdate with the timed action name to add additional context
data.
HashMap cdata = new HashMap<String, Object>();
cdata.put("myapp.ImageLiked", imageName);
Analytics.trackTimedActionUpdate("TimeUntilPurchase", cdata);
5. When the event completes, call trackTimedActionEnd and pass the timed action name and TimedActionBlock (callback),
which will look up all data and calculate durations.
Analytics.trackTimedActionEnd("TimeUntilPurchase", cdata);
Timed event metrics are saved in mobile solution variables for automatic reporting.
Analytics 45
Context data values must be mapped to custom variables in Adobe Mobile services:
Examples
// Timed Action Start Example
HashMap cdata = new HashMap<String, Object>();
cdata.put("ExperienceName", experience);
Analytics.trackTimedActionStart("TimeUntilPurchase", cdata);
The lifetime value allows you to measure and target on a lifetime value for each Android user. The value can be used to store
lifetime purchases, ad views, video completes, social shares, photo uploads, and so on.
Each time you send in a value with trackLifetimeValueIncrease, the value is added to the existing value. Lifetime value
is stored on device and can be retrieved at any time by calling lifetimeValue.
Context data values must be mapped to custom variables in Adobe Mobile services:
Products Variable
The products variable cannot be set by using processing rules. In the Mobile SDK, you must use a special syntax in the context
data parameter to set products on the server call.
To set the products variable, set a context data key to "&&products", and set the value by using the syntax that is defined for
the products variable:
cdata.put("&&products", "Category;Product;Quantity;Price[,Category;Product;Quantity;Price]");
For example:
//create a context data dictionary
HashMap cdata = new HashMap<String, Object>();
// add products, a purchase id, a purchase context data key, and any other data you want to
collect.
// Note the special syntax for products
cdata.put("&&products", ";Running Shoes;1;69.95,;Running Socks;10;29.99");
cdata.put("myapp.purchase", "1");
cdata.put("myapp.purchaseid", "1234567890");
The products variable is set on the image request, and the other variables are set as context data:
Analytics 47
You do not need to map the products variable by using processing rules because this variable is set directly on the image request
by the SDK.
// add products, a purchase id, a purchase context data key, and any other data you want to
collect.
// Note the special syntax for products
cdata.put("&&events", "event1");
cdata.put("&&products", ";Running Shoes;1;69.95;event1=5.5;eVar1=Merchandising,;Running
Socks;10;29.99");
cdata.put("myapp.purchase", "1");
cdata.put("myapp.purchaseid", "1234567890");
// trackState example:
Analytics.trackState("Order Confirmation", cdata);
Tip: If you trigger a product-specific event by using the &&products variable, you must also set that event in the &&events
variable. If you do not set that event, it is filtered out during processing.
Event Serialization
Event serialization is not supported by processing rules. In the Mobile SDK, you must use a special syntax in the context data
parameter to set serialized events directly on the server call.
cdata.put("&&events", "event1:12341234");
For example:
//create a context data dictionary
HashMap cdata = new HashMap<String, Object>();
// add events
cdata.put("&&events", "event1:12341234");
Video Analytics
Here is some information about measuring video on Android by the video measurement solution.
Tip: During video playback, frequent "heartbeat" calls are sent to this service to measure time played. These heartbeat calls
are sent every 10 seconds, which results in granular video engagement metrics and more accurate video fallout reports. For
more information about Adobe's video measurement solution, see Measuring Video in Adobe Analytics using Video Heartbeat.
The general process to measure video is similar across all platforms. This content provides an overview of the developer tasks
with code samples.
a.media.name • eVar (Required) When a visitor views the video in some way, this
• Default expiration: Visit context data variable collects the name of the video, as specified
in the implementation. You can add classifications for this
• Custom Insight (s.prop, used for variable.
video pathing)
(Optional) The Custom Insight variable provides video pathing
information.
a.media.segment • eVar (Required) Collects video segment data, including the segment
• Default expiration: Page view name and the order in which the segment occurs in the video.
1:M:0-25
a.contentType • eVar Collects data about the type of content that is viewed by a visitor.
• Default expiration: Page view Hits sent by video measurement are assigned a content type of
video.
a.media.timePlayed • Event Counts the time, in seconds, that is spent watching a video since
the last data collection process (image request).
Analytics 50
• Type: Counter
a.media.view • Event Indicates that a visitor has viewed some portion of a video.
• Type: Counter However, it does not provide any information about how much,
or which part, of a video that the visitor viewed.
a.media.segmentView • Event Indicates that a visitor has viewed some portion of a video
• Type: Counter segment. However, it does not provide any information about
how much, or which part, of a video that the visitor viewed.
a .media.complete • Event Indicates that a user has viewed a complete video. By default,
• Type: Counter the complete event is measured 1 second before the end of the
video.
Classes
Class: MediaSettings
public String name;
public String playerName;
public String playerID;
public double length;
public String channel;
public String milestones;
public String offsetMilestones;
public boolean segmentByMilestones;
public boolean segmentByOffsetMilestones;
public int trackSeconds = 0;
public int completeCloseOffsetThreshold = 1;
// MediaAnalytics Ad settings
public String parentName;
public String parentPod;
public String CPM;
public double parentPodPosition;
public boolean isMediaAd;
Analytics 51
Class: MediaState
public Date openTime = new Date();
public String name;
public String segment;
public String playerName;
public String mediaEvent;
public int offsetMilestone;
public int segmentNum;
public int milestone;
public double length;
public double offset;
public double percent;
public double timePlayed;
public double segmentLength;
public boolean complete = false;
public boolean clicked = false;
public boolean ad;
public boolean eventFirstTime;
Method Description
settingsWith
Returns a MediaSettings object with specified parameters.
Syntax:
public static MediaSettings adSettingsWith(String name, double length,
String playerName, String parentName, String parentPod, double
parentPodPosition, String CPM);
Example:
MediaSettings mySettings = Media.settingsWith("name", 10, "playerName",
"playerId");
adSettingsWith
Returns a MediaSettings object for use with tracking an ad video.
Syntax:
public static MediaSettings adSettingsWith(String name, double length,
String playerName, String parentName, String parentPod, double
parentPodPosition, String CPM);
Example:
open
Opens a MediaSettings object for tracking.
Syntax:
public static void open(MediaSettings settings, MediaCallback callback);
Example:
Media.open(mySettings, new Media.MediaCallback() {
@Override
public void call(Object item) {
// monitor callback if you want to be notified every second the media
is playing
}
});
close
Closes the media item named name.
Analytics 52
Method Description
Syntax:
public static void close(String name);
Example:
Media.close("name");
play
Plays the media item named name at the given offset in seconds.
Syntax:
public static void play(String name, double offset);
Example:
complete
Manually mark the media item as complete at the offset provided in seconds.
Syntax:
public static void complete(String name, double offset);
Example:
Media.complete("name", 0);
stop
Notifies the media module that the video has been stopped or paused at the given offset.
Syntax:
public static void stop(String name, double offset);
Example:
Media.stop("name", 0);
click
Notifies the media module that the media item has been clicked.
Syntax:
public static void click(String name, double offset);
Example:
Media.click("name", 0);
track
Sends a track action call (no page view) for the current media state.
Syntax:
public static void track(String name, Map<String, Object> data);
Example:
Media.track("name", null);
Analytics 53
Postbacks
Postbacks allow you to send data that is collected by the SDK to a third-party server. By leveraging the same triggers and traits
that you use to display an in-app message, you can configure the SDK to send customized data to a third-party destination.
Additional Information
Looking for information and documentation related to the Adobe Experience Platform Mobile SDK? Click here for our latest
documentation.
Important: As of September 2018, we released a new, major version of the SDK. These new Adobe Experience Platform
Mobile SDKs are configurable through Experience Platform Launch. To get started, go to Launch. To see what is in the
Experience Platform SDK repositories, go to Github: Adobe Experience Platform SDKs.
Postback messages are queued and follow all existing online/offline rules that govern analytics data collection. When a message
matches (like shown-messages do), postback messages do not cancel the rest of the messages. This allows for multiple postbacks
to occur on the same analytics hit. For the definition, see the postbacks row in ADBMobile JSON Config.
Template Expansions
Template expansions are available in the templateurl and templatebody properties. Template items take the form of {key},
where key is a context data key or traditional data key. The values that are available for template expansion are limited to the
standard Lifecycle variables list, in addition to any custom data that is attached to the hit that triggers the message. No historical-
or segment-based data is available at this time.
There are also specific, reserved templates that the SDK will automatically replace with internal data that is known to the SDK.
{%adid%} Returns Advertiser ID for Android. Note, this only works if you have used
submitAdvertisingIdentifierTask.
{%pushid%} Returns the Push Identifier token. Note, this only works if you have used setPushIdentifier.
Postbacks Example
You can use this information to help you understand postbacks are and how they work.
: This example is provided for informational purposes only. The ADBMobileConfig.json file should be configured in the
Adobe Mobile UI and should not be manually modified. A manually edited configuration file can be dangerous when you have
remote messages configuration enabled.
• ADBMobileConfig.json Definition
• Code Sample
ADBMobileConfig.json Definition
"messages": [
{
"messageId": "79ae37c9-89b9-465e-af7f-d3351771f1dc",
"template": "callback",
"payload": {
"templateurl":
"http://my.server.com/?user={user.name}&zip={user.zip}&c16={%sdkver%}&c27=cln,{a.PrevSessionLength}",
"templatebody":
"c2RrdmVyPXslc2RrdmVyJX0mY2I9eyVjYWNoZWJ1c3QlfSZjbGllbnRJZD17bi5jbGllbnQuaWR9JnRzPXsldGltZXN0YW1wVSV9JnRzej17JXRpbWVzdGFtcFolfQ==",
"contenttype": "application/x-www-form-urlencoded",
"timeout": 4
},
"showOffline": true,
"showRule": "always",
"endDate": 2524730400,
"startDate": 0,
"audiences": [],
"triggers": [
{
"key": "pageName",
"matches": "eq",
"values": [
"MainMenu"
]
}
]
}
]
Code Sample
HashMap<String, Object> contextData = new HashMap<String, Object>();
contextData.put("user.name", "bob");
contextData.put("user.zip", "90210");
Analytics.trackState("MainMenu", contextData);
Because its state is “MainMenu”, this tracking call triggers the above postback message. The URL will replace all template
variables with values from the hit. Assuming that the user’s previous session was 132 seconds long, and that user is on Android
SDK version 4.6.0, the resulting URL would look like this:
http://my.server.com/?user=bob&zip=90210&c16=4.6.0-AN&c27=cln,132
PII Postbacks
You can use the Adobe SDK to collect personally identifiable information (PII) and send it to a third-party endpoint.
Analytics 55
When you want to use the Adobe SDK to collect PII, you should send a track PII call. Although using this call enables collection
of PII data, the SDK does not automatically send the data to an Adobe endpoint. A PII type postback needs to be configured
with the appropriate endpoint.
Tip: An endpoint that supports HTTPS is required to use the PII postback type.
3. When you are ready to capture PII, call trackPII to send a hit for this action, event, or view:
Config.collectPII(new HashMap<String, Object>(){{
put("key","value");
}});
Analytics Methods
Here is a list of Adobe Analytics methods that are provided by the Android library.
The SDK currently supports multiple Adobe Experience Cloud Solutions, including Analytics, Target, Audience Manager, and
the Experience Cloud ID Service. Methods are prefixed according to the solution, for example, Experience Cloud ID methods
are prefixed with analytics.
Each of the following methods is used to send data to your Adobe Analytics report suite:
Method Description
trackState
Tracks an app state with optional context data.
States are the views that are available in your app, such as home dashboard, app settings, cart,
and so on. These states are similar to pages on a website, and trackState calls increment page views.
If state is empty, app name app version (build) is displayed in reports. If you see this value
in reports, ensure that you set state in each trackState call.
Tip: This is the only tracking call that increments page views.
Syntax:
public static void trackState(String state, Map<String, Object> contextData);
Example:
Analytics.trackState("loginScreen", null);
trackAction
Tracks an action in your app.
Actions that you want to measure, such as logons, banner taps, feed subscriptions, and
other metrics, that occur in your app.
Analytics 56
Method Description
Syntax:
public static void trackAction(String state, Map<String, Object>
contextData);
Example:
Analytics.trackAction("heroBannerTouched", null);
getTrackingIdentifier
Returns the automatically generated visitor identifier for Analytics.
This is an app-specific, unique visitor ID that is generated at the initial launch and is stored and used
from that point forward. The ID is preserved between app upgrades and is removed when the app is
uninstalled.
Syntax:
public static String getTrackingIdentifier();
Example:
String trackingId = Analytics.getTrackingIdentifier();
trackLocation
Sends the current latitude, longitude, and location in a defined point of interest
Syntax:
public static void trackLocation(Location location, Map<String, Object>
contextData);
Example:
Analytics.trackLocation(userLocation, null);
trackLifetime
Adds amount to the user's lifetime value.
ValueIncrease
Syntax:
public static void trackLifetimeValueIncrease(BigDecimal amount, Map<String,
Object> contextData);
Example:
Analytics.trackLifetimeValueIncrease(new BigDecimal(30), null);
trackTimedActionStart
Start a timed action with name action.
If you call this method for an action that has already started, the previous timed action is overwritten.
Syntax:
public static void trackTimedActionStart(String action, Map<String, Object>
contextData);
Example:
Analytics.trackTimedActionStart("cartToCheckout", null);
Analytics 57
Method Description
trackTimed
Pass in contextData to update the context data that is associated with the action.
ActionUpdate
The data that is passed in is appended to the existing data for the action, and if the same key is already
defined for action, overwrites the data.
Syntax:
public static void trackTimedActionUpdate(String action, Map<String, Object>
contextData);
Example:
HashMap cdata = new HashMap<String, Object>();
cdata.put("quantity", 3);
Analytics.trackTimedActionUpdate("cartToCheckout", cdata);
trackTimedActionEnd
End a timed action.
If you provide block, you can access the final time values and can manipulate data before sending
the final hit.
Tip: If you provide block, you must return true to send a hit. Passing null for block sends
the final hit.
Syntax:
public static void trackTimedActionEnd(String action,
TimedActionBlock<Boolean> logic);
Example:
Analytics.trackTimedActionEnd("cartToCheckout", new
Analytics.TimedActionBlock<Boolean>() {
@Override
public Boolean call(long inAppDuration, long totalDuration, Map<String,
Object> contextData) {
contextData.put("price", 49.95);
return true;
}
});
Regardless of how many hits are queued, this method forces the library to send all hits in the offline
queue.
Syntax:
void sendQueuedHits()
Examples:
Analytics.sendQueuedHits();
getQueueSize Returns the number of stored tracking calls in the offline queue.
Analytics 58
Method Description
Syntax:
long getQueueSize()
Examples:
long queueSize = Analytics.getQueueSize();
Syntax:
void clearQueue()
Examples:
Analytics.clearQueue();
: Use caution when manually clearing the queue. This process cannot be reversed.
Acquisition 59
Acquisition
This information helps you use acquisition tracking links in your Android apps.
Important: As of September 2018, we released a new, major version of the SDK. These new Adobe Experience Platform
Mobile SDKs are configurable through Experience Platform Launch. To get started, go to Launch. To see what is in the
Experience Platform SDK repositories, go to Github: Adobe Experience Platform SDKs.
Important: If you are using the Adobe Experience Platform Mobile SDKs with Adobe Launch, you must also install the
Adobe Analytics Mobile Services extension to use Adobe Mobile Services features such as Acquisition Links. For more
information about this extension, see Adobe Analytics - Mobile Services extension. For information about using Acquisition
and marketing links with the Experience Platform SDKs, see Acquisition and marketing links.
Acquisition links with unique tracking codes can be generated in Adobe Mobile services. When a user downloads and runs an
app from the app store after clicking on the generated link, the SDK automatically collects and sends the acquisition data to
Adobe Mobile services.
Important: To use Acquisition, you must have SDK version 4.1 or later.
Acquisition links must be created in Adobe Mobile services. For more information, see App Acquisition Analytics.
If you cannot use the acquisition links that are created in Adobe Mobile Services, the acquisition data can still be collected and
sent by the SDK by using Google Play Acquisition.
Custom acquisition data can be used with the standard Google Play Acquisition key value pairs.
• When the user downloads and runs an app as the result of a Google Play store acquisition, the data from the referrer will be
collected and sent to Adobe Mobile Services.
• The data will be stored and available in the AdobeDataCallback instance that was registered earlier with the SDK.
If you are using the Acquisition links that were created on Adobe Mobile Services, add custom data to the acquisition link by
completing the following tasks:
When the SDK receives the acquisition data from Adobe Mobile Services (on first launch), that data will be stored and also
available in the AdobeDataCallback instance registered earlier with the SDK, as mentioned in Configuration Methods.
2. The MobileDataEvent.MOBILE_EVENT_ACQUISITION_INSTALL or the
MobileDataEvent.MOBILE_EVENT_ACQUISITION_LAUNCH event type will be used.
3. The custom data keys will be prefixed with "a.acquisition.custom."
Tip: If you are sending data to multiple report suites, use the acquisition data from the app that is associated with the first
report suite in your list of report suite IDs.
The updates in this section enable the SDK to send acquisition data from an acquisition link.
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
4. Update AndroidManifest.xml to enable the BroadcastReceiver that was created in the previous step:
<receiver android:name="com.your.package.name.GPBroadcastReceiver" android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>
Important: If you are sending data to multiple report suites, use the acquisition settings (acquisition server and appid)
from the app that is associated with the first report suite in your list of report suite IDs.
Acquisition 61
The acquisition settings are generated by Adobe Mobile services and should not be changed. For more information about
how to download a customized ADBMobileConfig.json file with the acquisition settings pre-configured, see Before
You Start.
After these settings are enabled, after the initial launch of the app, acquisition data is sent automatically with the initial lifecycle
call.
: referrerTimeout must be set to a value higher than 0 to enable app acquisition.
Acquisition Methods
Method Description
campaignStartForApp Allows developers to start an app acquisition campaign as if the user clicked a link. This is
helpful for creating manual acquisition links and handling the app store redirect yourself.
Syntax
public static void campaignStartForApp(final String appId, final
Map<String, Object> data);
Example
Acquisition.campaignStartForApp("0652024f-adcd-49f9-9bd7-2552a4564d2f",
new HashMap<String, Object>() {{
put("custom.key", "value");
}});
You can use this information to track deep and deferred deep links in your mobile apps by using the Adobe Mobile Android
SDK.
This topic contains the following information:
• Getting Started
• Deep Link Public Information
Getting Started
Tracking Deep Links
Config.collectLifecycleData(this);
...
}
}
The Adobe Mobile SDK can parse key and value pairs of data that is appended to any deep or universal link as long as the link
contains a key with the a.deeplink.id label and a corresponding non-null and user-generated value. All key and value pairs
of data that are appended to the link will be parsed, attached to a lifecycle hit, and sent to Adobe Analytics as long as the link
contains the a.deeplink.id key and value.
Additionally, you might append one or more of the following reserved keys (with user-generated values) to the deep or universal
link:
• a.launch.campaign.trackingcode
• a.launch.campaign.source
• a.launch.campaign.medium
• a.launch.campaign.term
• a.launch.campaign.content
These keys are pre-mapped variables for reporting in Adobe Analytics. For more information on mapping and processing rules,
see Processing Rules and Context Data.
With a deferred deep link, the Adobe SDK will open a new Intent with the deep link as the intent data. This process is handled
as an external deep link using the code above.
If the application is set up correctly, the trackAdobeDeepLink() API should enable collecting the deep link information from
the Facebook acquisition campaign and send it to Adobe Mobile Service. If the install hit has not been sent to Adobe Mobile
Service at the first launch, this information will be added to the Lifecycle hit. Otherwise, it will be sent as an Adobe deep link
hit.
Tip: Ensure that the deep link URL has a key called a.deeplink.id. If the URL is missing the deep link ID parameter,
the URL parameters will not be appended to the context data.
If the link can be attributed to an acquisition, the Adobe Mobile SDK will store the acquisition data from the Facebook deep
link that was used to call trackAdobeDeepLink(). This data will be available to the Adobe Mobile SDK in future launches.
If a callback has been registered, the Adobe callback will also be used to send the data back to the client.
For more information, see Allowing Other Apps to Start your Activity.
2. Link the Facebook SDKs.
To add the Facebook gradle dependency in the app, complete the steps in Getting Started Android SDK.
3. To initialize the Facebook SDK, complete the instructions in the Android Studio Setup section.
4. Call trackAdobeDeepLink() from the main activity.
@Override
protected void onResume() {
super.onResume();
AppEventsLogger.activateApp(this);
/*
* Adobe Tracking - Config
*
* call collectLifecycleData() to begin collecting lifecycle data
* must be in the onResume() of every activity in your app
*/
Config.collectLifecycleData(this);
AppLinkData.fetchDeferredAppLinkData(this,
new AppLinkData.CompletionHandler() {
@Override
public void onDeferredAppLinkDataFetched(AppLinkData appLinkData) {
// Process app link data
if (appLinkData != null) {
Config.trackAdobeDeepLink(appLinkData.getTargetUri());
Acquisition 64
}
}
}
);
}
The following instructions help you roundtrip an acquisition campaign with a marketing link on an Android device.
If your mobile app is not yet in Google Play, you can select any mobile app as a destination when creating the marketing link.
This only affects the app to which the acquisition server redirects you, after you click the acquisition link, and not the ability to
test the acquisition link. Query string parameters are passed to the Google Play store, which are passed to the app at install as
part of a campaign broadcast. Roundtrip mobile app acquisition testing requires the simulation of this type of broadcast.
The app must be freshly installed, or have data cleared in Settings, each time a test is run. This ensures that the initial lifecycle
metrics that are associated with the campaign query string parameters are sent when the app is first launched.
1. Complete the prerequisite tasks in Mobile App Acquisition and ensure that you have correctly implemented the broadcast
receiver for INSTALL_REFERRER.
2. In the Adobe Mobile Services UI, click Acquisition > Marketing Links Builder and generate an acquisition marketing link
URL that sets Google Play as the destination for Android devices.
For more information, see Marketing Links Builder.
For example:
https://c00.adobe.com/v3/da120731d6c09658b82d8fac78da1d5fc2d09c48e21b3a55f9e2d7344e08425d/start?a_dl=573e5bb3248a501360c2890b
If you cannot get the unique ID on the device, run the following CURL command on your desktop to get the unique ID from
the response string.
curl -A "Mozilla/5.0 (Linux; Android 5.0.2; SAMSUNG SM-T815Y Build/LRX22G) AppleWebKit/537.36
(KHTML, like Gecko) Chrome/44.0.2403.133 Safari/537.36" <Your Marketing Link>
For example:
curl -A "Mozilla/5.0 (Linux; Android 5.0.2; SAMSUNG SM-T815Y Build/LRX22G) AppleWebKit/537.36
(KHTML, like Gecko) Chrome/44.0.2403.133 Safari/537.36"
https://c00.adobe.com/v3/da120731d6c09658b82d8fac78da1d5fc2d09c48e21b3a55f9e2d7344e08425d/start?a_dl=573e5bb3248a501360c2890b
5. Construct the acquisition end link by using the unique ID from step 3, by using the following format:
http://c00.adobe.com/v3/<appid>/end?a_ugid=<unique id>
For example:
http://c00.adobe.com/v3/<appid>/end?a_ugid=91b52ce097b1464b9b47cb2995c493cc6ab2c3a3
Setting Value
analytics For testing purposes, set the referrer timeout to allow for adequate time (60 seconds or more)
to manually send the broadcast. You can restore the original timeout setting after testing.
9. Connect the device to a computer, uninstall, and install the app again.
10. Launch ADB Shell and launch the application on the device.
adb shell
12. Replace com.adobe.android with your application's package name, update the receiver reference with the reference of
the location of the campaign tracking receiver in your app, and replace the values that are associated with utm_content.
If the broadcast is successful, you should expect a response like the following example:
Broadcasting: Intent
{ act=com.android.vending.INSTALL_REFERRER cmp=com.adobe.adms.tests/.ReferralReceiver (has
extras) }
Broadcast completed: result=0
13. (Optional) You can enable debug logging of the SDK to obtain additional information.
If everything works correctly, you should see following logs:
"Analytics - Received referrer information(<referrer content>)"
"Analytics - Trying to fetch referrer data from (acquisition end url)";
"Analytics - Received Referrer Data(<A JSON Response>)"
If you do not see these logs, verify that you have completed performed steps 6 to 10.
The following table contains additional information about the possible errors:
Error Description
Error Description
Analytics - Acquisition referrer timed Failed to get the response in the time defined by
out. referrerTimeout. Increase the value and try again.
1. Download acquistionTester.zip.
2. Extract the .jar file.
For example:
java -jar acquisitionTester.jar -a com.adobe.test -r com.adobe.test.ReferrerReceiver -l
"https://c00.adobe.com/v3/appid/start?a_i_id=123456&a_g_id=com.adobe.test&a_dd=i&ctxa.referrer.campaign.name=name&ctxa.referrer.campaign.trackingcode=1234
• The marketing links are cached on the server side with a ten-minutes expiration time.
When you make changes to marking links, wait about 10 minutes before the changes take effect before you use the links again.
Testing V3 Acquisition
This information helps you roundtrip a version 3 acquisition campaign link on an Android device.
Important: Acquisition in version 3 refers to the acquisition links that you create with the Acquisition Builder in the Adobe
Mobile Services UI. To use this feature, you must upgrade to Android SDK 4.x for Experience Cloud Solutions 4.6.0 or later.
If the mobile app is not yet in Google Play, when creating the campaign link, you can select any mobile app as a destination.
This only affects the app to which the acquisition server redirects you after you click the acquisition link, but does not affect the
Acquisition 67
ability to test the link. Query string parameters are passed to the Google Play store, which are passed to the app at install as part
of a campaign broadcast. Roundtrip mobile app acquisition testing requires the simulation of this type of broadcast.
The app must be freshly installed, or have data cleared in Settings, each time a test is run. This ensures that the initial lifecycle
metrics that are associated with the campaign query string parameters are sent when the app is first launched.
1. Complete the prerequisite tasks in Mobile App Acquisition and ensure that you have correctly implemented the broadcast
receiver for INSTALL_REFERRER.
2. In the Adobe Mobile Services UI, click Acquisition > Marketing Links Builder and generate an acquisition marketing link
URL that sets Google Play as the destination for Android devices.
For more information, see Marketing Links Builder.
For example:
http://c00.adobe.com/v3/<appid>/start?a_i_id=iostestapp&a_g_id=com.adobe.android&a_dd=g&ctxa.referrer.campaign.name=name&ctxa.referrer.campaign.trackingcode=trackingcode
Tip: If you refer to both Android and iOS apps in the acquisition link, use Google Play as the default store.
For example:
http://c00.adobe.com/v3/<appid>/end?a_ugid=91b52ce097b1464b9b47cb2995c493cc6ab2c3a3
If you do not see contextData, or some of the string is missing, ensure that the acquisition URL follows the format in
Create Acquisition Link Manually.
7. Repeat step 3 to obtain a new unique ID.
8. Verify that the following settings in your config file are correct:
Setting Value
analytics For testing purposes, set the referrer timeout to allow for adequate time (60 seconds or more)
to manually send the broadcast. You can restore the original timeout setting after testing.
9. Connect the device to a computer, uninstall, and install the app again.
10. Launch ADB Shell and launch the application on the device.
Acquisition 68
13. (Optional) You can enable debug logging of the SDK to obtain additional information.
If everything works correctly, you should see following logs:
"Analytics - Received referrer information(<referrer content>)"
"Analytics - Trying to fetch referrer data from (acquisition end url)";
"Analytics - Received Referrer Data(<A JSON Response>)"
If you do not see the above logs, verify that you completed steps 6 to 12.
The following table contains additional information about the possible errors:
Error Description
Analytics - Acquisition referrer timed Failed to get the response in the time defined by
out. referrerTimeout. Increase the value and try again.
You should also ensure that you have opened the acquisition
link before installing the app.
• For more information about how to broadcast INSTALL_REFERRER, see Testing Google Play Campaign Measurement in the
Google Developers guide.
• A bug fix was released for acquisition on Android 4.8.2.
1. Download acquistionTester.zip.
2. Extract the .jar file.
For example:
java -jar acquisitionTester.jar -a com.adobe.test -r com.adobe.test.ReferrerReceiver -l
"https://c00.adobe.com/v3/appid/start?a_i_id=123456&a_g_id=com.adobe.test&a_dd=i&ctxa.referrer.campaign.name=name&ctxa.referrer.campaign.trackingcode=1234
The following information helps you roundtrip a legacy acquisition campaign link on an Android device.
If the mobile app is not yet in Google Play, you can select any mobile app as a destination when creating the campaign link. This
only affects the app to which the acquisition server redirects you, after you click the acquisition link, and not the ability to test
the acquisition link. Query string parameters are passed to the Google Play store, which are passed to the app at install as part
of a campaign broadcast. Roundtrip mobile app acquisition testing requires the simulation of this type of broadcast.
The app must be freshly installed, or have data cleared in Settings, each time a test is run. This ensures that the initial lifecycle
metrics that are associated with the campaign query string parameters are sent when the app is first launched.
You will also see an image request sent to Adobe's data collection servers. If the SDK waits for the complete duration of the
referrer timeout, which you set in step 1, with an image request that does not include campaign parameters, the broadcast failed.
Messaging 71
Messaging
This information helps you use messaging in your Android apps.
Important: As of September 2018, we released a new, major version of the SDK. These new Adobe Experience Platform
Mobile SDKs are configurable through Experience Platform Launch. To get started, go to Launch. To see what is in the
Experience Platform SDK repositories, go to Github: Adobe Experience Platform SDKs.
Important: If you are using the Adobe Experience Platform Mobile SDKs with Adobe Launch, you must also install the
Adobe Analytics Mobile Services extension to use Adobe Mobile Services features such as in-app messaging and push
notifications,. For more information about this extension, see Adobe Analytics - Mobile Services extension. For information
about using push messaging and in-app messaging with the Experience Platform SDKs, see Set up push messaging and Set
up in-app messaging.
In-App Messaging
You can deliver in-app messages that are triggered from any analytics data or event. After the implementation, messages are
dynamically delivered to the app and do not require a code update.
Important: To use in-app messaging, you must have SDK version 4.2 or later.
You can create messages and the rules in Adobe Mobile services that define when messages are displayed. For more information,
see Create an in-app message. To display in-app messages, updates must be made to the SDK. You can complete these steps even
if you have not yet defined any messages. After you define messages, they will be delivered dynamically to your app and displayed
without an app store update.
If you selected a modal layout, select one of the following themes for the message:
• Theme.Translucent.NoTitleBar.Fullscreen
Messaging 72
• Theme.Translucent.NoTitleBar
• Theme.Translucent
For example:
<activity
android:name="com.adobe.mobile.MessageFullScreenActivity"
android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"
android:windowSoftInputMode="adjustUnspecified|stateHidden" />
<receiver android:name="com.adobe.mobile.MessageNotificationHandler" />
4. In each collectLifecycleData call, pass this to provide a reference to your current activity:
@Override
public void onResume() {
Config.collectLifecycleData(this);
}
5. Verify that ADBMobileConfig.json contains the required settings for in-app messaging.
For in-app messages to be dynamically updated on launch, the remotes object must be present and properly configured:
“messages”: [
{
“messageId”: “de45c43c-37bf-441f-8cbd-cc3ba3469ebe”,
“template”: “fullscreen”,
“showOffline”: false,
“showRule”: “always”,
“endDate”: 2524730400,
“startDate”: 0,
“audiences”: [],
“triggers”: [],
“payload”: { // contents change depending on template
“html”: “<html>html code goes here</html>”
},
},
…
]
“remotes” : {
“analytics.poi”: “https://assets.adobedtm.com/…/yourfile.json”,
“messages”: “https://assets.adobedtm.com/…/yourfile.json”
}
If this object is not configured, download an updated ADBMobileConfig.json from Adobe Mobile services. For more
information, see Before You Start.
• For custom, full screen in-app messages, the HTML content in the message needs to include the correct code to notify the
SDK tracking about the following buttons:
Messaging 73
Important: The fallback image asset name is specified when you configure the message in Adobe Mobile services, and you
need to ensure that the specified resource is available.
Method Description
Config.setSmallIconResourceId(int
Set the small icon that will be used for notifications that are created by the SDK. This icon appears
resourceId)
in the status bar and is the secondary image that is displayed shown when the user sees the complete
notification in the notification center.
Syntax:
public static void setSmallIconResourceId(final int resourceId);
Example:
Config.setSmallIconResourceId(R.drawable.appIcon);
Config.setLargeIconResourceId(int
Set the large icon that will be used for notifications that are created by the SDK. This icon will be
resourceId)
the primary image that is displayed when the user sees the complete notification in the notification
center.
Syntax:
public static void setLargeIconResourceId(final int resourceId);
Example:
Config.setLargeIconResourceId(R.drawable.appIcon);
Are you putting the new Verify that the SDK is version 4.2 or higher and is correctly configured. For more
configuration and new SDK in the information, see View Hits for a screen shot showing the SDK version.
app?
Messaging 74
Ensure that you have a Messages section in your configuration (downloaded JSON file),
or have a Messages remote endpoint, so that it can be retrieved from dynamic tag
management.
Important: As of April 30, 2017, Adobe Bloodhound has been sunset. Starting on
May 1, 2017, no additional enhancements and no additional Engineering or Adobe
Expert Care support will be provided.
My full screen message in Android Did you update your manifest file to define the full screen activity?
is not showing up. I am using the
correct SDK, configuration, and my
triggers are being met.
My local notification message in Ensure that the local notification broadcast receiver is declared in your manifest.
Android is not working.
For more information, see step 2 in Enabling In-App Messaging.
Is the message live? To verify whether your message is live, on the Manage In-App Message page, in the
Status column, check the list of messages.
Double check the traits/trigger Verify the assumptions in data for traits/trigger in Bloodhound.
sections.
Validate the hits in Bloodhound. For more information, see View Hits in Bloodhound
documentation for a screen shot that displays the SDK version.
Important: As of April 30, 2017, Adobe Bloodhound has been sunset. Starting on
May 1, 2017, no additional enhancements and no additional Engineering or Adobe
Expert Care support will be provided.
Look at show once, show always, Verify that these settings are set the way you want. On the Audience tab, review your
show offline settings on the Audience Trigger options, which allow you to specify how often the message is shown.
tab.
If using launch event as trigger... Launch only fires on a new session. For more information about when a session begins,
see the lifecycleTimeout row in JSON Config.
If the app was restarted during the life cycle session timeout, your new config might not
have been downloaded.
Messaging 75
My image does not fit exactly into The In-App Message full-screen template supports displaying an image from a remote
the space provided by the template. server (Image URL) or from the app bundle (Bundled Image). The image should be in a
standard image format, such as JPG, GIF or PNG.
Because device screens have many different dimensions, the image will most likely not
fit exactly into the space provided by the template. The template focuses on showing the
center of the image and, if the image does not fit, crops (portrait) or fades (landscape)
the sides.
Here is the exact placement and sizing rules for each orientation:
• Portrait
• A height of 195px for phones
• A height of 529px for tablets
• Centered if the image width is smaller than the device width.
• Cropped if the image width is greater than the device width.
• Landscape
• The image scaled to 100% of the height of the device.
• The width is 75% of the device, with a fade out on the right.
If you have issues with the full-screen template, you can download and use the Custom
HTML template. This template provides more flexibility for images and allows full control
of the template.
Push Messaging
Adobe Mobile and the Adobe Mobile SDK allow you to send push messages to your users. The SDK also allows you to easily
report users who have opened your app after clicking through a push message.
Important: To use push messaging, you must have SDK version 4.6 or later.
Important: Do not manually set the Experience Cloud ID inside your app. This causes the creation of a new unique user
that will not receive push messages because of its opt-in status. For example, a user has opted-in to receive push messages
logs in to your app. After logging in, if you manually set the ID inside your app, a new unique user is created who has not
opted to receive push messages. This new user will not receive your push messages.
• Prerequisites
• Enable Push Messaging
Messaging 76
Prerequisites
• Add the library to your project and implement lifecycle metrics.
• SDK must be enabled for the ID Service.
Important: Moving your app to a new report suite is not supported. If you migrate to a new report suite, your push
configuration can break, and messages might not be sent.
Tip: If your app is already set up to use messaging by using Google Cloud Messaging (GCM), some of the following steps
might already be completed.
1. Verify that ADBMobileConfig.json contains the required settings for push messaging.
The "marketingCloud" object must have its "org" property configured for push messaging.
"marketingCloud": {
"org": <org-id-string>
}
2. Obtain the registration ID/token by using the GCM or Firebase Cloud Messaging (FCM) APIs.
• GCM
• For more information about setting up GCM, see Set up a GCM Client App on Android.
• To implement a sample app, see Google Samples.
InstanceID instanceID = InstanceID.getInstance(this);
String token = instanceID.getToken(getString(R.string.gcm_defaultSenderId),
GoogleCloudMessaging.INSTANCE_ID_SCOPE, null);
• FCM
• For more information about setting up FCM, see Set Up a Firebase Cloud Messaging Client App on Android.
String token = FirebaseInstanceId.getInstance().getToken();
3. The registration ID/token must be passed to the SDK by using the Config.setPushIdentifier(final String
registrationId) method.
Config.setPushIdentifier(token); // token was obtained in step 2
This can be done using the method putExtras (Click here for more info).
• In the target activity of the clickthrough, the activity must be passed into the SDK with the collectLifecycleData call.
You can get the URL by calling data.getString("adb_deeplink") in the customized GcmListenerService class or
remoteMessage.getData().get("adb_deeplink") in the FirebaseMessagingService.
Tip: You can define different intents depending on whether the payload has a deep linking URL.
• If the deep linking URL is in the push payload, create a ACTION_VIEW intent with the URL.
When the user clicks the push message, a deep link is triggered.
• If the deep linking URL is not in the push payload, create an intent that will open one of your activities.
Here is an example that uses a GCM implementation to pass data to the Mobile SDK after the message is received:
@Override
public void onMessageReceived(String from, Bundle data) {
String message = data.getString("message");
String deeplink = data.getString("adb_deeplink");
sendNotification(message, deeplink);
}
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 /* Request code */, intent,
PendingIntent.FLAG_ONE_SHOT);
NotificationManager notificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
if (deeplink!=null) {
intent = new Intent(Intent.ACTION_VIEW, Uri.parse(deeplink));
} else {
intent = new Intent(this, MainActivity.class);
}
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.putExtras(pushData);
NotificationManager notificationManager =
(NotificationManager)getApplicationContext().getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(0, notificationBuilder.build());
}
Important: The class that contains the onMessageReceived() implementation to handle the data that is received.
If the push message contains a Media URL, the URL will be available in the Bundle parameter that is passed to the
onMessageReceived() function. The key to be used is attachment-url as shown in the following code sample:
public class MyGcmListenerService extends GcmListenerService {
@Override
Messaging 79
if (attachmentUrl != null) {
Bitmap image = getBitmapFromURL(attachmentUrl);
if (image != null) {
notificationBuilder.setStyle(new NotificationCompat.BigPictureStyle().bigPicture(image));
}
}
//Display the Notification
NotificationManager notificationManager =
(NotificationManager)getApplicationContext().getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(0, notificationBuilder.build());
Important: When you set NotificationCompat.BigPictureStyle, large images might not be displayed. To ensure
that large images are always displayed, set the native Notification.BigPictureStyle.
For more information about rich push notifications with Android, see Engage with Rich Notifications.
Why are there sometimes delays The following types of delays might be associated with push messages for Mobile
sending push messages? Services:
• Waiting for Analytics Hits
Messaging 81
Every report suite has a setting to determine when to process incoming Analytics hits.
The default is 1 hour on the hour. The actual processing of Analytics hits might take
up to 30 minutes but is typically 15-20 minutes.
For example, a report suite processes hits every hour. If you factor in the processing
time of a maximum of 30 minutes, it could take up to 90 minutes for an incoming hit
to be available for a push message. If a user launched the app at 9:01 AM, the hit would
show up in the Mobile Services UI as a new unique user between 10:15 to 10:30 AM.
• Waiting for Push Service
The push service (APNS or GCM) might not immediately send out the message.
Although uncommon, we have seen a delay of 5-10 minutes. On the Messages page,
you can verify that the push message has been sent to the push service by clicking the
View link for the message. In the report, the number of successful sends to the push
service is listed in the Published column.
Tip: The push services do not guarantee a message will be sent. For more
information about the reliability of services, see the appropriate documentation:
• APNS: Quality of Service
• GCM: Lifetime of a Message
Why are my push messages being cut For some Android devices, you might need to use
off or are not expanding? NotificationCompat.BigTextStyle when displaying messages.
Location 82
Location
This information helps you use the Location feature in your Android apps.
Important: As of September 2018, we released a new, major version of the SDK. These new Adobe Experience Platform
Mobile SDKs are configurable through Experience Platform Launch. To get started, go to Launch. To see what is in the
Experience Platform SDK repositories, go to Github: Adobe Experience Platform SDKs.
Geo-location helps you measure location data by using latitude and longitude and predefined points of interest in your Android
apps.
Each trackLocation call sends the following information:
• Latitude, longitude, and location in a point of interest (POI) that is defined in the Adobe Mobile Services UI.
This information is passed to mobile solution variables for automatic reporting.
• Distance from center and accuracy passed as context data.
These variables are not captured automatically. You must map these context data variables by using the instructions in Sending
Additional Data.
If this is not configured, you must download an updated version of the ADBMobile.json file and add it to your app. For more
information, see Download the SDK.
You can use Android Location Strategies to determine the location that is passed to the trackLocation call.
Additionally, if the location is determined to be in a defined POI radius, an a.loc.poi context data variable is sent in with the
trackLocation hit and is reported as a POI on the Location Breakdown reports. An a.loc.dist context variable is also
sent with the distance in meters from the defined coordinates.
Context data values must be mapped to custom variables in the Adobe Mobile Services UI:
For example, the coordinates lat = 40.93231, long = -111.93152 represent a location with 1 m precision. This location is split
according to the level of precision across the following variables:
a.loc.lat.a = 040.9
a.loc.lat.b = 32
a.loc.lat.c = 31
a.loc.lon.a = -111.9
a.loc.lon.b = 31
a.loc.lon.c = 52
Location 84
Some precision levels might appear as 00 depending on the accuracy of the current location. For example, if the location is
currently accurate to 100m, a.loc.lat.c and a.loc.lon.c will be populated with 00.
Additional Information
Remember the following information:
We recommend calling trackLocation when the app starts and then as needed, depending on the app's requirements.
• POIs are populated only after they are defined in the app's configuration file.
The POIs are not applied to historical trackLocation calls that were previously sent.
• trackLocation calls support sending additional context data similar to trackAction calls.
• When two POIs have overlapping diameters, the first POI that contains the current location is used.
If your POIs overlap, you should list POIs in order of most to least granular to ensure that the most granular POI is reported.
Beacon tracking
Beacon tracking allows you to measure and target micro locations by using iBeacon and Bluetooth Low Energy.
The following beacon data is sent to Analytics and Target when trackBeacon is called:
• a.beacon.uuid - ProximityUUID of the beacon
• a.beacon.major - Major number of the beacon (such as store number)
• a.beacon.minor - Minor number of the beacon (such as a unique number within a store)
• a.beacon.prox - Values of 0-3 represent how close the user is to the beacon.
Here is what these values mean:
• 0 = unknown
• 1 = immediate
• 2 = near
• 3 = far
Tracking Beacons
1. Add the library to your project and implement lifecycle.
2. Import the library:
import com.adobe.mobile.*;
Multiple third-party libraries are available to scan Bluetooth LE beacons, depending on the manufacturer of the beacon.
Location 85
4. After the beacon information has been obtained, use the following call to track the location:
// assumed that the following variables will have been retrieved by the 3rd party beacon
library
String beaconUUID;
String major;
String minor;
Analytics.BEACON_PROXIMITY proximity;
// BEACON_PROXIMITY is an enum available in the SDK. Number 0-3 representing how close the
// user is to the beacon. 0 unknown, 1 immediate, 2 near, 3 far.
Analytics.trackBeacon(beaconUUID, major, minor, proximity, null);
5. When the user leaves the beacon's proximity, clear the current beacon:
Analytics.clearBeacon();
Context data values must be mapped to custom variables in the Adobe Mobile services UI:
Target 86
Target
This information helps you deliver targeted content in Android applications.
Important: As of September 2018, we released a new, major version of the SDK. These new Adobe Experience Platform
Mobile SDKs are configurable through Experience Platform Launch. To get started, go to Launch. To see what is in the
Experience Platform SDK repositories, go to Github: Adobe Experience Platform SDKs.
Target Configuration
Additional Information
Looking for information and documentation related to the Adobe Experience Platform Mobile SDK? Click here for our latest
documentation.
Important: As of September 2018, we released a new, major version of the SDK. These new Adobe Experience Platform
Mobile SDKs are configurable through Experience Platform Launch. To get started, go to Launch. To see what is in the
Experience Platform SDK repositories, go to Github: Adobe Experience Platform SDKs.
For example:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Config.setContext(this.getApplicationContext());
}
If you already added this method call when you implemented Analytics or Audience Management, you do not need to add it
again.
Target Methods
Here is the list of Adobe Target methods that are provided by the Android library.
The SDK currently supports multiple Adobe Experience Cloud Solutions, including Analytics, Target, Audience Manager, and
the Experience Cloud ID Service. Methods are prefixed according to the solution. For example, Experience Cloud ID methods
are prefixed with target.
String Constants
Tip: The following constants are for ease of use when you set keys for custom parameters.
Important:
• If you are using SDKs before version 4.14.0, see http://developers.adobetarget.com/api/#input-parameters for parameters
limitations.
• If you are using SDKs version 4.14.0 or after, see http://developers.adobetarget.com/api/#batch-input-parameters for
parameters limitations.
Method Description
loadRequest Sends request to your configured Target server and returns the string value of the offer that is
generated in a block callback.
Syntax:
public static void loadRequest(TargetLocationRequest request,
TargetCallback<String> callback);
Example:
Target.loadRequest(heroBannerRequest, new Target.TargetCallback<String>()
{
@Override
public void call(String item) {
// do something with item
}
});
Syntax:
public static void loadRequest(final String name, final String
defaultContent, final Map<String, Object> profileParameters, final
Map<String, Object> orderParameters,
final Map<String, Object> mboxParameters,
final TargetCallback<String> callback)
Example:
Map<String, Object> profileParameters = new HashMap<String, Object>();
profileParameters.put(“profile-parameter-key”, “profile-parameter-value”);
Target 88
Method Description
loadRequest Sends request to your configured Target server and returns the string value of the offer that is
generated in a block callback.
Syntax:
public static void loadRequest(final String name, final String
defaultContent, final Map<String, Object> profileParameters, final
Map<String, Object> orderParameters,
final Map<String, Object> mboxParameters,
final TargetCallback<String> callback)
Example:
Map<String, Object> profileParameters = new HashMap<String, Object>();
profileParameters.put(“profile-parameter-key”, “profile-parameter-value”);
loadRequest Sends a request to your configured Target server and returns the string value of the offer that is
generated in a TargetCallback.
Syntax:
public static void loadRequest(final String name, final String
defaultContent, final Map<String, Object> profileParameters, final
Map<String, Object> orderParameters, final Map<String, Object>
mboxParameters, final Map<String, Object> requestLocationParameters, final
TargetCallback<String> callback);
Returns: N/A
Parameters:
Target 89
Method Description
Name: Description:
This method will be called with the content of the offer from the Target
server. If the Target server is unreachable or the user does not qualify
for the campaign, defaultContent will be returned.
Example:
Map<String, Object> profileParameters = new HashMap<String, Object>();
profileParameters.put(“profile-parameter-key”, “profile-parameter-value”);
Method Description
Target.loadRequest(“mboxName”, “defaultContent”, profileParameters,
orderParameters, mboxParameters, requestLocationParameters,new
TargetCallback<String>() {
@Override
public void call (String item) {
Log.d(“Target Content”, item);
}
});
For more information about the underlying Target API, see Delivery in the Target Developer's help.
Example:
TargetLocationRequest orderConfirm =
Target.createOrderConfirmRequest("orderConfirm", "order", "47.88", "3722",
null);
Syntax:
public static TargetLocationRequest createRequest(String name, String
defaultContent, Map<String, Object> parameters);
Example:
TargetLocationRequest heroBannerRequest = Target.createRequest("heroBanner",
"default.png", null);
Syntax:
public static void clearCookies();
Example:
Target.clearCookies();
Syntax:
public static String getPcID();
Example:
Target.getPcID();
Syntax:
public static String getSessionID();
Target 91
Method Description
Example:
Target.getSessionID();
Syntax:
public static String setThirdPartyID(final String thirdPartyId);
Example:
Target.setThirdPartyID(“third-party-id”);
Syntax:
public static String getThirdPartyID();
Example:
String thirdPartyId = Target.getThirdPartyID();
The Adobe Target prefetch feature uses the Android Mobile SDKs to fetch offer content as few times as possible by caching the
server responses.
This process reduces the load time, prevents multiple network calls, and allows Adobe Target to be notified which mbox was
visited by the mobile app user. All content will be retrieved and cached during the prefetch call, and this content will be retrieved
from the cache for all future calls that contain cached content for the specified mbox name.
Prefetch content does not persist across launches. The prefetch content is cached as long as the application lives or until the
clearPrefetchCache() method is called.
Important: Target prefetch APIs have been available since SDK version 4.14.0. For more information about parameter
limitations, see http://developers.adobetarget.com/api/#batch-input-parameters.
In SDK version 4.14 or later, if specified, the environmentId is picked from the ADBMobileConfig.json file when initiating
a v2 batch mbox TnT call. If no environmentId is specified in this file, no environment parameter is sent in TNT batch mbox
call, and offer is delivered for the default environment.
For example:
if (MobileConfig.getInstance().mobileUsingTarget()){
long environmentID = MobileConfig.getInstance().getEnvironmentID();
if(environmentID != 0L){
parametersJson.put(TargetJson.ENVIRONMENT_ID, environmentID);
}
}
Pre-fetch Methods
Here are the methods that you can use for prefetch in Android:
Target 92
Parameter Description
prefetchContent Sends a prefetch request with an array of locations to the configured Target server and returns
the request status in the provided callback.
Syntax
public static void prefetchContent(
final List<TargetPrefetchObject> targetPrefetchArray,
final Map<String, Object> profileParameters,
final TargetCallback<Boolean> callback)
Parameters
Name Description
profileParameters Contains the keys and values of profile parameters to be used with
every location prefetch in this request.
callback
Invoked when the prefetch is complete.
Returns true if the prefetch was successful and false if the prefetch
was unsuccesful.
loadRequests Executes a batch request for multiple mbox locations that are specified in the requests array.
Each object in the array contains a callback function, which will be invoked when content is
available for its given mbox location.
Important: If the content for the requested locations is already cached, it will be returned
immediately in the provided callback. Otherwise, the SDK will send a network request to
the Target servers to retrieve the content.
Syntax:
public static void loadRequests(
final List<TargetRequestObject> requestArray,
final Map<String, Object> profileParameters)
Parameters:
Name Description
Parameter Description
Syntax:
public static void clearPrefetchCache();
Parameters: N/A
createTargetRequestObject Creates and returns an instance of TargetRequestObject with the provided data.
Syntax:
public static TargetPrefetchObject createTargetRequestObject(
final String mboxName,
final String defaultContent,
final Map<String, Object> mboxParams,
final Map<String, Object> orderParams,
final Map<String, Object> productParams,
final Target.TargetCallback<String> callback)
createTargetPrefetchObject Creates and returns an instance of TargetPrefetchObject with the provided data.
Syntax:
public static TargetPrefetchObject createTargetPrefetchObject(
final String mboxName,
final Map<String, Object> mboxParams)
final Map<String, Object> orderParams,
final Map<String, Object> productParams)
Public Classes
Here are the public classes that support pre-fetch in Android:
Encapsulates the mbox name and the parameters that are used for mbox prefetch.
Property Description
Collection of key-value pairs that will be attached to current mbox under the order node.
Collection of key-value pairs that will be attached to current mbox under the product node.
This class encapsulates the mbox name, default content, mbox parameters and the return callback used for Target location
requests.
Property Description
Collection of key-value pairs that will be attached to current mbox under the order node.
Collection of key-value pairs that will be attached to current mbox under the product node.
String value that is returned in the callback if the SDK is unable to retrieve content from
Target servers.
Function pointer that will be called when content for the given TargetRequestObject is
available.
Code Sample
Here is an example of how to prefetch content by using the Android SDKs:
// When your app launches, prefetch the content for a list of locations.
// Define the list of mboxes that you want to prefetch.
List<TargetPrefetchObject> prefetchMboxesList = new ArrayList<>();
prefetchMboxesList.add(Target.createTargetPrefetchObject("mboxName2", mboxParameters2,
orderParameters2, productParameters2));
// When the content is required, you can initiate the locations request.
// Define the list of target request objects.
List<TargetRequestObject> locationRequests = new ArrayList<>();
locationRequests.add(Target.createTargetRequestObject("mboxName1", "defaultContent1",
mboxParameters1, callback1));
locationRequests.add(Target.createTargetRequestObject("mboxName2", "defaultContent2",
mboxParameters2, orderParameters2, productParameters2, callback2));
Additional Information
Here is some additional information about these samples:
Target Preview allows you to easily perform end-to-end QA for Target activities and preview these activities on your device.
For more information on how to set up and use Target Preview, go to Target Mobile Preview.
Important: To use Target Preview, you need SDK version 4.14.0 or later.
Method Description
setPreviewRestartDeeplink
Sets an app deeplink that will be triggered when preview selections
are applied in the Preview mode.
Syntax
public static void setPreviewRestartDeeplink(String
deeplink);
Example
Target.setPreviewRestartDeeplink(“myapp://myhost”);
Experience Cloud 97
Experience Cloud
This information helps you use the Android SDK with the Adobe Experience Cloud.
Important: As of September 2018, we released a new, major version of the SDK. These new Adobe Experience Platform
Mobile SDKs are configurable through Experience Platform Launch. To get started, go to Launch. To see what is in the
Experience Platform SDK repositories, go to Github: Adobe Experience Platform SDKs.
The Experience Cloud ID service provides a universal visitor ID across Experience Cloud solutions. The ID service is required
by Analytics for Target, video heartbeat, and future Experience Cloud integrations.
Tip: You do not need to populate this ID unless you are using the Experience Cloud ID service. For more information, see
Experience Cloud ID Service.
Experience Cloud organization IDs uniquely identify each client company in the Adobe Experience Cloud and are similar
to the following value:
016D5C175213CCA80A490D05@AdobeOrg
If these IDs are not configured, download an updated ADBMobileConfig.json from Adobe Mobile services. For more
information, see Before You Start.
After the configuration is complete, a Experience Cloud ID is generated and is included on all hits. Other IDs, such as custom
and automatically-generated IDs, continue to be sent with each hit.
Here are the Experience Cloud ID methods that are provided by the Android library.
Experience Cloud 98
The SDK currently supports multiple Adobe Experience Cloud Solutions, including Analytics, Target, Audience Manager, and
the Experience Cloud ID Service.
Methods are prefixed according to the solution. For example, Experience Cloud ID methods are prefixed with visitor. For
more information, see Experience Cloud ID Configuration.
Method Description
public static String
Appends Adobe visitor data to a URL string for use with the Adobe JavaScript library. You must
appendToURL(final
String URL) have Mobile SDK 4.12+ to use this method. For more information, see Append Visitor ID Helper
Function.
Important: This method can cause a blocking network call. Do not call this on time-sensitive
threads.
• Input: URL<java.lang.String>
Example:
String urlSample = "http://example.com";
String urlWithAdobeVisitorInfo = Visitor.appendToURL(urlSample);
getMarketingCloudId
Retrieves the Experience Cloud ID from the visitor ID service.
• Syntax:
public static String getMarketingCloudId();
• Example:
String mcid = Visitor.getMarketingCloudId();
Important: This method can cause a blocking network call and should not be called from a
UI thread.
syncIdentifiers With the Experience Cloud ID, you can set additional customer IDs that can be associated with
each visitor. The Visitor API accepts multiple customer IDs for the same visitor, with a customer
type identifier to separate the scope of the different customer IDs. This method corresponds to
setCustomerIDs in the JavaScript library.
• Syntax:
public static void syncIdentifiers(Map<String, String> identifiers);
Experience Cloud 99
Method Description
• Example:
Map<String, String> identifiers = new HashMap<String, String>();
identifiers.put("idType", "idValue");
Visitor.syncIdentifiers(identifiers);
syncIdentifer Synchronizes the provided identifier type and value to the Visitor ID service. Pass in the
authenticationState as one of the following values:
• VisitorID.VisitorIDAuthenticationState.VISITOR_ID_AUTHENTICATION_STATE_UNKNOWN
• VisitorID.VisitorIDAuthenticationState.VISITOR_ID_AUTHENTICATION_STATE_AUTHENTICATED
• VisitorID.VisitorIDAuthenticationState.VISITOR_ID_AUTHENTICATION_STATE_LOGGED_OUT
• Syntax:
public static void syncIdentifier(final String identifierType, final
String identifier, final VisitorID.VisitorIDAuthenticationState
authenticationState);
• Example:
Visitor.syncIdentifier("myIdType", "valueForUser",
VisitorID.VisitorIDAuthenticationState.VISITOR_ID_AUTHENTICATION_STATE_LOGGED_OUT);
syncIdentifiers Synchronizes the provided identifiers to the ID service. Pass in the authenticationState as one
of the following values:
• VisitorID.VisitorIDAuthenticationState.VISITOR_ID_AUTHENTICATION_STATE_UNKNOWN
• VisitorID.VisitorIDAuthenticationState.VISITOR_ID_AUTHENTICATION_STATE_AUTHENTICATED
• VisitorID.VisitorIDAuthenticationState.VISITOR_ID_AUTHENTICATION_STATE_LOGGED_OUT
• Syntax:
public static void syncIdentifiers(final Map<String, String> identifiers,
final VisitorID.VisitorIDAuthenticationState authenticationState);
• Example:
Map<String, String> identifiers = new HashMap<String, String>();
identifiers.put("myIdType", "valueForUser");
Visitor.syncIdentifiers(identifiers,
VisitorID.VisitorIDAuthenticationState.VISITOR_ID_AUTHENTICATION_STATE_AUTHENTICATED);
• Syntax:
public static List<VisitorID> getIdentifiers();
• Example:
List<VisitorID> myVisitorIDs = Visitor.getIdentifiers();
Public Methods
public class VisitorID {
public final String idOrigin;
public final String idType;
Experience Cloud 100
To start using the Experience Cloud Device Co-op, contact your Adobe representative.
To enable your mobile apps for the Experience Cloud Device Co-op, complete the following steps for the Experience Cloud
Android SDKs:
Starting in SDK version 4.16.1, Device Co-op members can opt their mobile device data out of the Experience Cloud Device
Co-op. For more information see ADBMobile JSON Config, and the visitorAPI.js method for isCoopSafe.
coopUnsafe flag
• The Boolean property of the marketingCloud object that, when set to true, will cause device to be opted-out of the Experience
Cloud's Device Co-op.
• Default value is false.
• This setting is used only for Device Co-op provisioned customers.
For Device Co-op members who require this value set to true, you need to work with the Co-op team to request a blacklist flag
on your Device Co-op account. There is no self-service path to enabling these flags.
• When coopUnsafe is set to true, coop_unsafe=1 will always be appended to Audience Manager and Visitor ID hits.
• If you enable Analytics server-side forwarding to Audience Manager, you will also see coop_unsafe=1 on Analytics hits.
Audience Manager 101
Audience Manager
This information helps you send signals and retrieve visitor segments from Audience Manager.
Important:
As of September 2018, we released a new, major version of the SDK. These new Adobe Experience Platform Mobile SDKs
are configurable through Experience Platform Launch.
You can send signals and retrieve visitor segments from audience management.
Example:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Config.setContext(this.getApplicationContext());
}
If you already added this method call when you implemented Analytics or Target, you do not need to add it again.
Here is a list of the Audience Manager methods that are provided by the Android library.
The SDK currently supports multiple Adobe Experience Cloud Solutions, including Analytics, Target, Audience Manager, and
the Experience Cloud ID Service. Methods are prefixed according to the solution. For example, Experience Cloud ID methods
are prefixed with audience manager.
If Audience Manager is configured in your JSON file, a signal that contains lifecycle metrics is sent with your lifecycle hit.
getVisitorProfile
Returns the visitor profile that was most recently obtained and, if no signal has been submitted,
returns null. The visitor profile is saved in SharedPreferences for easy access across multiple
launches of your app.
• Syntax
public static HashMap<String, Object> getVisitorProfile();
Audience Manager 102
• Example
HashMap<String, Object> visitorProfile =
AudienceManager.getVisitorProfile();
getDpid
Returns the current DPID.
• Syntax
public static void getDpid();
• Example
String dpid = AudienceManager.getDpid();
getDpuuid
Returns the current DPUUID.
• Syntax
public static void getDpuuid();
• Example
String dpuuid = AudienceManager.getDpuuid();
setDpidAndDpuuid
Sets the DPID and DPUUID, and these values are sent with each signal.
• Syntax
public static void setDpidAndDpuuid(String dpid, String dpuuid);
• Example
AudienceManager.setDpidAndDpuuid("myDpid", "myDpuuid");
signalWithData
Sends audience management a signal with traits and gets the matching segments returned in a block
callback.
• Syntax:
public static void signalWithData(Map<String, Object> data,
AudienceManagerCallback<Map<String, Object>> callback);
• Example:
HashMap aamTraits = new HashMap<String, Object>();
aamTraits.put("trait", "b");
AudienceManager.signalWithData(aamTraits, new
AudienceManager.AudienceManagerCallback<Map<String, Object>>() {
@Override
public void call(Map<String, Object> item) {
// segments come back here, normally found in the segs object of your
json
}
});
Wearables 103
Wearables
Starting in Android SDK version 4.5, a new Android extension was added that allows you to collect data from your Android
Wearable app.
Important: As of September 2018, we released a new, major version of the SDK. These new Adobe Experience Platform
Mobile SDKs are configurable through Experience Platform Launch. To get started, go to Launch. To see what is in the
Experience Platform SDK repositories, go to Github: Adobe Experience Platform SDKs.
Starting in Android SDK version 4.5, a new Android extension was added that allows you to collect data from your Android
Wearable app.
This section contains the following information:
• Configuring the SDK for a Handheld App (Android Studio)
• Configuring the SDK for a Wearable App (Android Studio)
Tip: You might need to sync the gradle project after adding the .jar file.
3. In the onCreate method, allow the SDK access to your application context by using Config.setContext:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
<application>
.......
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
</application>
@Override
public void onMessageReceived(MessageEvent messageEvent) {
super.onMessageReceived(messageEvent);
}
@Override
public void onCreate() {
super.onCreate();
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addApi(Wearable.API)
.build();
mGoogleApiClient.connect();
}
@Override
public void onDestroy() {
super.onDestroy();
mGoogleApiClient.disconnect();
}
@Override
public void onDataChanged(com.google.android.gms.wearable.DataEventBuffer dataEvents) {
• Add the same ADBMobileConfig.json file to the assets folder of your wearable project.
Wearables 105
• Change the gradle config to use the ADBMobileConfig.json in the assets folder of the handheld app:
android {
sourceSets {
main {
assets.srcDirs = ['src/main/assets','../mobile/src/main/assets']
}
}
}
2. Add the adobeMobileLibrary-*.jar file to the libs folder or make sure it get referenced by the project.
You might need to sync the gradle project after adding the jar file.
3. In the onCreate method, allow the SDK access to your application context using Config.setContext:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// Allow the SDK access to the application context
Config.setContext(this.getApplicationContext(),
Config.ApplicationType.APPLICATION_TYPE_WEARABLE);
}
@Override
public void onDataChanged(com.google.android.gms.wearable.DataEventBuffer dataEvents) {
DataListenerWearable.onDataChanged(dataEvents);
}
</application>
Please find more information from google's blog
https://android-developers.googleblog.com/2016/04/deprecation-of-bindlistener.html.
Permalink Edit
Here is some information to help you configure the Android extension, which allows you to collect data from your Android
Wearable app.
• The Adobe Mobile Android Wearables extension requires Android version 4.4 (KitKat) or above.
• There is one additional context value, A.RunMode, which has been added to indicate whether the data comes from the
containing app or the extension.
• RunMode = Application (the hit comes from handheld app)
• RunMode = Extension (the hit comes from wearable app)
• The SDK automatically syncs the aid/vid/visitor service id/privacy status from the handheld app to the
wearable app, so do not call setPrivacyStatus/setUserIdentifier/idSync from the wearable app.
• In-app messages, Target, and Audience Manager are disabled for the wearable app.
Android SDK Reference 107
Important: As of September 2018, we released a new, major version of the SDK. These new Adobe Experience Platform
Mobile SDKs are configurable through Experience Platform Launch. To get started, go to Launch. To see what is in the
Experience Platform SDK repositories, go to Github: Adobe Experience Platform SDKs.
App IDs
The following table describes the different app identifiers that are used by the Android SDK and Adobe Mobile services.
ID Description
App Store ID
This ID is assigned to your app by the app store, and is provided in Adobe Mobile services when you
create acquisition links.
AppID in ADBMobile
This is a unique ID that is assigned to the app instance by Adobe Mobile services for all the associated
JSON Config
metadata in the system.
This ID is used to create the unique URLs for acquisition tracking or tracking link. This ID is
automatically added to the ADBMobile JSON config file when this file is downloaded from the UI and
can be found on Manage App Settings under the Acquisition settings for your app.
If your app opens mobile web content, ensure that visitors are not identified separately as they move between the native and
mobile web.
Visitor IDs in Apps
The Android SDK generates a unique visitor ID when an app is installed. This ID is stored in persistent memory on the mobile
device, is sent with every hit, and is removed only when the user uninstalls the app.
Typical mobile web implementations use the same standard Analytics s_code.js or AppMeasurement.js that is used in
desktop sites. The JavaScript libraries have their own methods of generating unique visitor IDs, which causes a different visitor
ID to be generated when you open mobile web content from your app.
Alternatively, starting with SDK version 4.16.0, you can call Visitor.getUrlVariablesAsync and generate your own
URL:
final String urlString = "http://www.mydomain.com/index.php";
Visitor.getUrlVariablesAsync(new Visitor.VisitorCallback(){
@Override
public void call(String urlVariables) {
final String urlStringWithVisitorData = String.format("%s?%s", urlString,
urlVariables);
final Intent browserIntent = new Intent(Intent.ACTION_VIEW,
Uri.parse(urlStringWithVisitorData));
startActivity(browserIntent);
}
});
The ID service code on the destination domain extracts the MID from the URL instead of sending a request to Adobe for a new
ID. The code uses the passed in MID to track the visitor.
On hits from the mobile web content, verify that the mid parameter exists on each hit, and that this value matches the mid
parameter that is sent by the app code.
Issue Answer
I do not see Visitor.appendToURL. Verify that the Adobe SDK that is bundled in the parent
application is version 4.12.0 or higher.
To ensure that the IDs that are appended to the URL that is
being opened, verify that the adobe_mc query parameter
appears in the URL.
Android SDK Reference 109
Issue Answer
If these troubleshooting steps do not resolve your issues, contact Adobe Experience Care.
Important: To allow Adobe can validate the implementation, you need to share a sample application and the associated
site.
Android Widgets
Android widgets can be tracked by using the same methods as your app. Widgets share the application context with your app,
so hit order and visitor identification is preserved.
Additional Information
Looking for information and documentation related to the Adobe Experience Platform Mobile SDK? Click here for our latest
documentation.
Important: As of September 2018, we released a new, major version of the SDK. These new Adobe Experience Platform
Mobile SDKs are configurable through Experience Platform Launch. To get started, go to Launch. To see what is in the
Experience Platform SDK repositories, go to Github: Adobe Experience Platform SDKs.
Important: As of September 2018, we released a new, major version of the SDK. These new Adobe Experience Platform
Mobile SDKs are configurable through Experience Platform Launch. To get started, go to Launch. To see what is in the
Experience Platform SDK repositories, go to Github: Adobe Experience Platform SDKs.
When Adobe provides software and services to an enterprise, Adobe acts as a data processor for any personal data it processes
and stores as part of providing these services. As a data processor, Adobe processes personal data in accordance with your
company’s permission and instructions (for example, as set out in your agreement with Adobe).
As a data controller, you can use Adobe Mobile Services SDKs to support GDPR retrieve and delete requests from your mobile
apps.
For the Adobe Mobile SDK portions of your mobile apps, you can use the following settings and methods:
• To retrieve data from the SDKs, and send this data to your servers, use the getAllIdentifiersAsync method.
• privacyDefault
• setPrivacyStatus
Additional Information
• For more information about GDPR, see GDPR and Your Business.
• To see the GDPR API documentation, go to General Data Protection Regulation API.
This information helps you retrieve locally stored, SDK identities from your Android app and with GDPR data access requests.
Important: The getAllIdentifiersAsync method retrieves identities stored in the SDK. You must call this method
before the user opts-out.
SDK identities (as applicable) are locally stored and returned in a JSON string, which might contain:
Important: Starting with Android SDK 4.15 , setting the privacy status to unknown holds Audience Manager and Experience
Cloud ID hits.
You can control whether the Analytics, Target, and Audience Manager activity is allowed on a device by using the following
settings:
• privacyDefault in ADBMobile JSON Config.
This setting controls the initial setting that persists until it is changed in the code.
• The Config.setPrivacyStatus method.
After the privacy setting is changed by using this method, this change remains effective until you change it again or when you
uninstall and install the app again. For more information about the methods, see Configuration Methods.
Examples
public void setOptIn(View view) {
Config.setPrivacyStatus(MobilePrivacyStatus.MOBILE_PRIVACY_STATUS_OPT_IN);
currentStatus = Config.getPrivacyStatus();
}
public void setOptOut(View view) {
Config.setPrivacyStatus(MobilePrivacyStatus.MOBILE_PRIVACY_STATUS_OPT_OUT);
currentStatus = Config.getPrivacyStatus();
}
public void setOptUnknown(View view) {
Config.setPrivacyStatus(MobilePrivacyStatus.MOBILE_PRIVACY_STATUS_UNKNOWN);
currentStatus = Config.getPrivacyStatus();
}
Using Bloodhound to Test Mobile Applications 113
Important: As of September 2018, we released a new, major version of the SDK. These new Adobe Experience Platform
Mobile SDKs are configurable through Experience Platform Launch. To get started, go to Launch. To see what is in the
Experience Platform SDK repositories, go to Github: Adobe Experience Platform SDKs.
Important: As of April 30, 2017, Adobe Bloodhound has been sunset. Starting on May 1, 2017, no additional enhancements
and no additional Engineering or Adobe Expert Care support will be provided.
PhoneGap Plug-in 114
PhoneGap Plug-in
This plug-in allows you to send Android AppMeasurement calls from your PhoneGap project.
Important: As of September 2018, we released a new, major version of the SDK. These new Adobe Experience Platform
Mobile SDKs are configurable through Experience Platform Launch. To get started, go to Launch. To see what is in the
Experience Platform SDK repositories, go to Github: Adobe Experience Platform SDKs.
For example, if your package is named com.example.phonegaptest, your android-package value would be the
following:
<param name="android-package" value="com.example.phonegaptest.ADBMobile_PhoneGap" />
The AppMeasurement library requires the following permissions to send data and record offline tracking calls:
• INTERNET
• ACCESS_NETWORK_STATE
To add these permissions, add the following lines to your AndroidManifest.xml file, which is in the application project
directory:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Update AndroidManifest.xml to declare the full screen activity and enable the Message Notification Handler:
<activity
android:name="com.adobe.mobile.MessageFullScreenActivity"
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
<receiver android:name="com.adobe.mobile.MessageNotificationHandler" />
If you select modal layout when you create a message in Adobe mobile services, select one of the following themes:
• Theme.Translucent.NoTitleBar.Fullscreen
• Theme.Translucent.NoTitleBar
• Theme.Translucent
For example:
<activity
android:name="com.adobe.mobile.MessageFullScreenActivity"
android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"
android:windowSoftInputMode="adjustUnspecified|stateHidden" />
<receiver android:name="com.adobe.mobile.MessageNotificationHandler" />
You can use Android PhoneGap Plug-in methods to complete a variety of tasks.
Here is a link of the Android PhoneGap Plug-in methods:
• Configuration
• Tracking
• Target
• Acquisition
• Audience Manager
• ID Service
PhoneGap Plug-in 116
• App Extensions
• Apple Watch Methods
In html files where you want to use tracking, add the following to the <head> tag:
<script type="text/javascript" charset="utf-8" src="ADB_Helper.js"></script>
• Configuration Methods
• PII Methods
• Tracking Methods
• Beacon Methods
• Target Methods
• Acquisition Methods
• Advertising Identifier
• Audience Manager Methods
• ID Service Methods
Configuration Methods
Method Description
• ADB.optedIn
• ADB.optUnknown
If your report suite is timestamp-enabled, hits are saved until the privacy status changes
to opt-in (hits are sent) or opt-out (hits are discarded). If your report suite is not
timestamp-enabled, hits are discarded until the privacy status changes to opt in.
Example:
getPrivacyStatus(function (value) { myTempVal = value; }, function
() { myTempVal = null; });
setPrivacyStatus Sets the privacy status for the current user to status.
• ADB.optedIn
Method Description
If your report suite is timestamp-enabled, hits are saved until the privacy status changes
to opt-in (hits are sent) or opt-out (hits are discarded). If your report suite is not
timestamp-enabled, hits are discarded until the privacy status changes to opt in.
Example:
ADB.setPrivacyStatus('ADB.optedIn');
Example:
ADB.getLifetimeValue(function (value) { myTempVal = value; },
function () { myTempVal = null; });
setDebugLogging Enables (true) or disables (false) viewing debug information. By default, this variable
is false.
Example:
ADB.setDebugLogging(true);
Example:
ADB.getVersion(function (value) { versionNum = value; }, function
() { versionNum = 1.0; });
This is an app-specific, unique visitor ID that is generated when the app is initially
launched and is stored and used from that point. This ID is preserved between app
upgrades and is removed when the app is uninstalled.
Tip: If your app upgrades from the Experience Cloud 3.x to 4.x SDK, the previous
visitor ID (custom or automatically generated) is retrieved and stored as the custom
user identifier. For more information, see the getUserIdentifier row below.
This ID preserves visitor data between SDK upgrades.
For new installations on the 4.x SDK, the user identifier is null and tracking identifier
is used.
Example:
ADB.trackingIdentifier(function (value) { myTempVal = value; },
function () { myTempVal = null; });
PhoneGap Plug-in 118
Method Description
getUserIdentifier If a customer user identifier has been set, returns this identifier; if the identifier has not
been set, returns null.
Example:
getUserIdentifier(function (value) { myTempVal = value; }, function
() { myTempVal = null; });
Example:
ADB.setUserIdentifier('testUser');
Syntax:
ADB.setPushIdentifier(pushIdentifier, success, fail);
Example:
ADB.setPushIdentifier('test_push_identifier',function (value) {
alert('success'); },function (value) { alert('fail'); });
Example:
ADB.keepLifecycleSessionAlive();
trackingSendQueuedHits Forces the library to send all queued hits regardless of current batch options.
Example:
ADB.trackingSendQueuedHits();
trackingGetQueueSize Gets or sets the number of stored tracking calls in the offline queue.
Example:
ADB.trackingGetQueueSize(function (value) { myTempVal = value; },
function () { myTempVal = null; });
trackingClearQueue Removes all stored tracking calls from the offline queue.
Method Description
Example:
ADB.trackingClearQueue(function (value) { myTempVal = value; },
function () { myTempVal = null; });
PII Methods
Method Description
Syntax:
ADB.collectPII(piiData, success, fail);
Example:
ADB.collectPII({'k1':'v1','k2':'v2','k3':'v3'}, function (value)
{ alert('success'); },function (value) { alert('fail'); });
Tracking Methods
Method Description
Tip: If the Lifecycle call is a launch event, the Adobe Link data will be appended,
otherwise an extra call will be sent.
Syntax:
ADB.trackAdobeDeepLink(deeplinkURL, success, fail);
Example:
ADB.trackAdobeDeepLink('xyz-deeplink-url', function (value) {
alert('success'); },function (value) { alert('fail'); });
trackState Tracks an app state with optional context data. States are the views that are available in
your app, such as such as home dashboard, app settings, cart, and so on. These
states are similar to pages on a website, and trackState calls increment page views.
Syntax:
ADB.trackState(string stateName[,JSON cData]);
Example:
ADB.trackState("login page");
ADB.trackState("login page", {"user":"john","remember":"true"});
PhoneGap Plug-in 120
Method Description
trackAction Tracks an action in your app. Actions include logins, banner taps, feed
subscriptions, and other metrics that occur in your app and that you want to measure.
Syntax:
ADB.trackAction(string action[,JSON cData]);
Example:
ADB.trackAction("login");
ADB.trackAction("login", {"user":"john","remember":"true"});
trackLocation Sends the current x y coordinates. Also uses points of interest defined in the
ADBMobileConfig.json file to determine if the location provided as a parameter is
within any of your POI. If the current coordinates are within a defined POI, a context
data variable is populated and sent with the trackLocation call.
Syntax:
ADB.trackLocation(x, y[,JSON cData]);
Example:
ADB.trackLocation('40.431596', '-111.893713');
Syntax:
ADB.trackLifetimeValueIncrease(amount[,JSON cData]);
Example:
ADB.trackLifetimeValueIncrease('10.01');
If you call this method for an action that has already started, the previous timed action
is overwritten.
Syntax:
ADB.trackTimedActionStart(action[,JSON cData]);
Example:
ADB.trackTimedActionStart("cartToCheckout");
trackTimedActionUpdate Pass in cData to update the context data that is associated with the action.
The cData that is passed is appended to the existing data for the action and, if the same
key is already defined for action, overwrites the data.
PhoneGap Plug-in 121
Method Description
Syntax:
ADB.trackTimedActionUpdate(String action[,JSON cData]);
Example:
ADB.trackTimedActionUpdate("cartToCheckout",{'SampleContextDataKey3':'SampleContextDataVal3','SampleContextDataKey4':'SampleContextDataVal4'});
Example:
ADB.trackTimedActionEnd("cartToCheckout");
Syntax:
ADB.trackingTimedActionExists(function (value) { myTempVal = value;
}, function () { myTempVal = null; });
Beacon Methods
Method Description
Syntax:
ADB.trackBeacon(uuid, major, minor, proximity, cData)
Example:
ADB.trackBeacon('2F234454-CF6D-4A0F-ADF2-F4911BA9FFA6', 1, 2,
ADB.beaconUnknown, {'hp':'hp_val','hp.company':'adobe'}
clearCurrentBeacon Clears the beacon data after a user leaves the proximity of the beacon.
Syntax:
ADB.clearCurrentBeacon(success, fail)
Example:
ADB.clearCurrentBeacon();
Target Methods
Method Description
targetLoadRequest Sends a request to your configured Target server and returns the string value of the offer.
PhoneGap Plug-in 122
Method Description
Syntax:
ADB.targetLoadRequest(success, fail, name, defaultContent,
parameters);
Example:
ADB.targetLoadRequest(function (value)
{ myTempVal = value; }, function () { myTempVal = null; },
'bannerOffer', 'none', {'hp':'hp_val_new','hp.company':'adobe',
'hp.val2':'hp_val2'});
Syntax:
ADB.targetLoadOrderConfirmRequest(success, fail, name, orderId,
orderTotal, productPurchaseId, parameters);
Example:
ADB.targetLoadRequest(function (value) { myTempVal = value; }
, function ()
{ myTempVal = null; }
, 'name', 'orderId', 'total', 'purchaseId',
{'hp':'hp_val_new','hp.company':'adobe', 'hp.val2':'hp_val2'}
);
Example:
ADB.targetClearCookies();
Syntax:
ADB.targetLoadRequestWithNameWithLocationParameters(
success, fail, name, defaultContent, profileParameters,
orderParameters, mboxParameters, requestLocationParameters
);
Example:
ADB.targetLoadRequestWithNameWithLocationParameters (function ()
{ alert('success'); }, function () { alert('fail'); },
'bannerOffer', 'none', {'hp':'hp_val_new','hp.company':'adobe',
'hp.val2':'hp_val2'}, {'hp':'hp_val_new','hp.company':'adobe',
'hp.val2':'hp_val2'},{'hp':'hp_val_new','hp.company':'adobe',
'hp.val2':'hp_val2'},{'hp':'hp_val_new','hp.company':'adobe',
'hp.val2':'hp_val2'});
Syntax:
ADB.targetLoadRequestWithRequestName(success, fail, name,
defaultContent, profileParameters, orderParameters,
mboxParameters);
PhoneGap Plug-in 123
Method Description
Example:
ADB.targetLoadRequestWithName(
function (value){ // handle target success},
function() { // handle target failure },
"mboxName",
"defaultContent",
{"profileParameters":"profileParametervalues"},
{"orderId" : "32FGJ4XK" , "orderTotal" : "123.33" ,
"purchasedProductIds":"[46,34]" },
{"mboxParameters":"mboxParametersvalues"}
);
targetSessionID Gets the value of the SessionID cookie returned for this visitor by the Targetserver.
Syntax:
ADB.targetSessionID (success, fail);
Example:
ADB.targetSessionID(function (value) { alert(value); },function
(value) { alert('fail'); });
targetPcID Gets the value of the PcID cookie that is returned for this visitor by the Target server.
Syntax:
ADB.targetPcID (success, fail);
Example:
ADB.targetPcID(function (value) { alert(value); },function (value)
{ alert('fail'); });
Syntax:
ADB.targetSetThirdPartyID(thirdPartyID, success, fail);
Example:
ADB.targetSetThirdPartyID('test-third-party-id', function (value)
{ alert('success'); },function (value) { alert('fail'); });
Syntax:
ADB.targetThirdPartyID(success, fail);
Example:
ADB.targetThirdPartyID(function (value) { alert(value); },function
(value) { alert('fail'); });
PhoneGap Plug-in 124
Acquisition Methods
Method Description
acquisitionCampaignStartForApp Sends a request to your configured Target server and returns the string value of the offer.
Syntax:
ADB.acquisitionCampaignStartForApp(appId, data, success, fail);
Example:
ADB.acquisitionCampaignStartForApp(“appId”, {‘key’:‘value’},
function() {…}, function() {…}));
ADB.acquisitionCampaignStartForApp(“appId”, {‘key’:‘value’});
Advertising Identifier
In the main activity that is generated by Cordova, call Config.submitAdvertisingIdentifierTask() in the onResume()
method. For more information, see Configuration Methods.
Method Description
Syntax:
ADB.audienceGetVisitorProfile();
Example:
ADB.audienceGetVisitorProfile(function(value) { profile = value;
}, function() { profile = null; });
Syntax:
ADB.audienceGetDpuuid(success, fail);
Example:
ADB.audienceGetDpuuid(function(value) { dpuuid = value; },
function() { dpuuid = null; });
Syntax:
ADB.audienceGetDpid(success, fail);
Example:
ADB.audienceGetDpid(function(value) { dpid = value; }, function()
{ dpid = null; });
Method Description
Syntax:
ADB.audienceSetDpidAndDpuuid(dpid, dpuuid, success, fail);
Example:
ADB.audienceSetDpidAndDpuuid(‘dpid’, ‘dpuuid’, function() {…},
function() {…});
ADB.audienceSetDpidAndDpuuid(‘dpid’, ‘dpuuid’);
Syntax:
ADB.audienceSignalWithData(success, fail, data);
Example:
ADB.audienceSignalWithData(function() {}, function() {}, {‘key1’:
’value1’, ‘key2’: ‘value2’});
ADB.audienceSignalWithData({‘key1’: ’value1’, ‘key2’: ‘value2’});
audienceReset Resets Audience Manager UUID and purges the current visitor profile.
Example:
ADB.audienceReset();
ID Service Methods
Method Description
Syntax:
ADB.visitorGetMarketingCloudId(success, fail);
Example:
ADB.visitorGetMarketingCloudId(function (value) { mcid = value; },
function () { mcid = null; });
Syntax:
ADB.visitorSyncIdentifiers(identifiers, success, fail);
Example:
ADB.visitorSyncIdentifiers({‘key_id_1’:’value_id_1’}, function()
{…}, function() {…}));
ADB.visitorSyncIdentifiers({‘key_id_1’: ‘value_id_1’});
Method Description
Syntax:
ADB.visitorSyncIdentifiersWithAuthenticationState
(identifiers, authenticationState, success, fail);
Example:
ADB.visitorSyncIdentifiersWithAuthenticationState({'k1':'v1','k2':'v2','k3':'v3'},
ADB.mobileVisitorAuthenticationStateAuthenticated, function (value)
{ alert('success'); },function (value) { alert('fail'); });
Syntax:
ADB.visitorSyncIdentifierWithType(identifierType, identifier,
authenticationState, success, fail);
Example:
ADB.visitorSyncIdentifierWithType('test-identifier-type',
'test-identifier',
ADB.mobileVisitorAuthenticationStateAuthenticated, function (value)
{ alert('success'); },function (value) { alert('fail'); });
Syntax:
ADB.visitorAppendToURL(urlToAppend, success, fail);
Example:
ADB.visitorAppendToURL('test_visitor_url', function (value) {
alert(value); },'');
Syntax:
ADB.visitorGetIDs (success, fail);
Example:
ADB.visitorGetIDs(function (value) { alert(value); },function
(value) { alert('fail'); });
Contact and Legal Information 127
Feedback
We welcome any suggestions or feedback regarding this solution. Enhancement ideas and suggestions can be added to our
Customer Idea Exchange.
Legal
© 2017 Adobe Systems Incorporated. All Rights Reserved.
Published by Adobe Systems Incorporated.
Adobe and the Adobe logo are either registered trademarks or trademarks of Adobe Systems Incorporated in the United States
and/or other countries. A trademark symbol (®, ™, etc.) denotes an Adobe trademark.
All third-party trademarks are the property of their respective owners. Updated Information/Additional Third Party Code
Information available at http://www.adobe.com/go/thirdparty.