Edit in GitHubLog an issue

API Reference

extensionVersion

The extensionVersion() API returns the version of the Identity for Edge Network extension.

Java

Syntax

Copied to your clipboard
public static String extensionVersion()

Example

Copied to your clipboard
String extensionVersion = Identity.extensionVersion();

Kotlin

Example

Copied to your clipboard
val extensionVersion = Identity.extensionVersion()

getExperienceCloudId

This API retrieves the Experience Cloud ID (ECID) that was generated when the app was initially launched. This ID is preserved between app upgrades, is saved and restored during the standard application backup process, and is removed at uninstall.

Java

Syntax

Copied to your clipboard
public static void getExperienceCloudId(final AdobeCallback<String> callback);
  • callback is invoked after the ECID is available. The callback may be invoked on a different thread.

Example

Copied to your clipboard
Identity.getExperienceCloudId(new AdobeCallback<String>() {
@Override
public void call(String id) {
// Handle the ID returned here
}
});

Kotlin

Example

Copied to your clipboard
Identity.getExperienceCloudId { id ->
// Handle the ID returned here
}

getIdentities

Get all identities in the Identity for Edge Network extension, including customer identifiers which were previously added.

Java

Syntax

Copied to your clipboard
public static void getIdentities(final AdobeCallback<IdentityMap> callback);
  • callback is invoked after the identities are available. The return format is an instance of IdentityMap. The callback may be invoked on a different thread.

Example

Copied to your clipboard
Identity.getIdentities(new AdobeCallback<IdentityMap>() {
@Override
public void call(IdentityMap identityMap) {
// Handle the IdentityMap returned here
}
});

Kotlin

Example

Copied to your clipboard
Identity.getIdentities { identityMap ->
// Handle the IdentityMap returned here
}

getUrlVariables

Returns the identifiers in a URL's query parameters for consumption in hybrid mobile applications. The response will not return any leading & or ?, since the caller is responsible for placing the variables in the resulting URL in the correct locations. If an error occurs while retrieving the URL variables, the callback handler will return a null value. Otherwise, the encoded string is returned.

An example of an encoded string is as follows: "adobe_mc=TS%3DTIMESTAMP_VALUE%7CMCMID%3DYOUR_ECID%7CMCORGID%3D9YOUR_EXPERIENCE_CLOUD_ID"

  • MCMID: This is also known as the Experience Cloud ID (ECID).
  • MCORGID: This is also known as the Experience Cloud Organization ID.
  • TS: The timestamp that is taken when the request was made.

Java

Syntax

Copied to your clipboard
public static void getUrlVariables(final AdobeCallback<String> callback);
  • callback has a String value that contains the visitor identifiers as a query string after the service request is complete.

Example

Copied to your clipboard
Identity.getUrlVariables(new AdobeCallback<String>() {
@Override
public void call(String urlVariablesString) {
// Handle the URL query parameter string here
// For example, open the URL in a webView
WebView webView;
webView = (WebView)findViewById(R.id.your_webview); // Initialize with your webView
webview.loadUrl("https://example.com?" + urlVariablesString);
}
});

Kotlin

Example

Copied to your clipboard
Identity.getUrlVariables { urlVariablesString ->
// Handle the URL query parameter string here
// For example, open the URL in a webView
val webView = findViewById<WebView>(R.id.your_webview) // Initialize with your webView
webView.loadUrl("http://www.example.com?" + urlVariablesString)
}

registerExtension

Java

Syntax

Copied to your clipboard
public static void registerExtension()

Example

Copied to your clipboard
import com.adobe.marketing.mobile.edge.identity.Identity
...
Identity.registerExtension();

removeIdentity

Remove the identity from the stored client-side IdentityMap. The Identity extension will stop sending the identifier to the Edge Network. Using this API does not remove the identifier from the server-side User Profile Graph or Identity Graph.

Identities with an empty id or namespace are not allowed and are ignored.

Removing identities using a reserved namespace is not allowed using this API. The reserved namespaces are:

  • ECID
  • IDFA
  • GAID

Java

Syntax

Copied to your clipboard
public static void removeIdentity(final IdentityItem item, final String namespace);

Example

Copied to your clipboard
IdentityItem item = new IdentityItem("user@example.com");
Identity.removeIdentity(item, "Email");

Kotlin

Example

Copied to your clipboard
val item = IdentityItem("user@example.com")
Identity.removeIdentity(item, "Email")

resetIdentities

Clears all identities stored in the Identity extension and generates a new Experience Cloud ID (ECID). Using this API does not remove the identifiers from the server-side User Profile Graph or Identity Graph.

This is a destructive action, since once an ECID is removed it cannot be reused. The new ECID generated by this API can increase metrics like unique visitors when a new user profile is created.

Some example use cases for this API are:

  • During debugging, to see how new ECIDs (and other identifiers paired with it) behave with existing rules and metrics.
  • A last-resort reset for when an ECID should no longer be used.

This API is not recommended for:

  • Resetting a user's consent and privacy settings; see Privacy and GDPR.
  • Removing existing custom identifiers; use the removeIdentity API instead.
  • Removing a previously synced advertising identifier after the advertising tracking settings were changed by the user; use the setAdvertisingIdentifier API instead.

See MobileCore.resetIdentities for more details.

setAdvertisingIdentifier

When this API is called with a valid advertising identifier, the Identity for Edge Network extension includes the advertising identifier in the XDM Identity Map using the namespace GAID (Google Advertising ID) in Android and IDFA (Identifier for Advertisers) in iOS. If the API is called with the empty string (""), null/nil, or the all-zeros UUID string values, the advertising identifier is removed from the XDM Identity Map (if previously set).

The advertising identifier is preserved between app upgrades, is saved and restored during the standard application backup process, and is removed at uninstall.

Java

Syntax

Copied to your clipboard
public static void setAdvertisingIdentifier(final String advertisingIdentifier);
  • advertisingIdentifier is an ID string that provides developers with a simple, standard system to continue to track ads throughout their apps.

Example

Copied to your clipboard
import com.google.android.gms.ads.identifier.AdvertisingIdClient;
import com.google.android.gms.common.GooglePlayServicesNotAvailableException;
import com.google.android.gms.common.GooglePlayServicesRepairableException;
import java.io.IOException;
import android.util.Log;
...
@Override
public void onResume() {
super.onResume();
...
new Thread(new Runnable() {
@Override
public void run() {
String advertisingIdentifier = null;
try {
AdvertisingIdClient.Info adInfo = AdvertisingIdClient.getAdvertisingIdInfo(getApplicationContext());
if (adInfo != null) {
if (!adInfo.isLimitAdTrackingEnabled()) {
advertisingIdentifier = adInfo.getId();
} else {
Log.d("ExampleActivity", "Limit Ad Tracking is enabled by the user, cannot process the advertising identifier");
}
}
} catch (IOException e) {
// Unrecoverable error connecting to Google Play services (e.g.,
// the old version of the service doesn't support getting AdvertisingId).
Log.d("ExampleActivity", "IOException while retrieving the advertising identifier " + e.getLocalizedMessage());
} catch (GooglePlayServicesNotAvailableException e) {
// Google Play services is not available entirely.
Log.d("ExampleActivity", "GooglePlayServicesNotAvailableException while retrieving the advertising identifier " + e.getLocalizedMessage());
} catch (GooglePlayServicesRepairableException e) {
// Google Play services is not installed, up-to-date, or enabled.
Log.d("ExampleActivity", "GooglePlayServicesRepairableException while retrieving the advertising identifier " + e.getLocalizedMessage());
}
MobileCore.setAdvertisingIdentifier(advertisingIdentifier);
}
}).start();
}

Kotlin

  • advertisingIdentifier is an ID string that provides developers with a simple, standard system to continue to track ads throughout their apps.

Example

Copied to your clipboard
import android.content.Context
import android.util.Log
import com.google.android.gms.ads.identifier.AdvertisingIdClient
import com.google.android.gms.common.GooglePlayServicesNotAvailableException
import com.google.android.gms.common.GooglePlayServicesRepairableException
import java.io.IOException
...
suspend fun getGAID(applicationContext: Context): String {
var adID = ""
try {
val idInfo = AdvertisingIdClient.getAdvertisingIdInfo(applicationContext)
if (idInfo.isLimitAdTrackingEnabled) {
Log.d("ExampleActivity", "Limit Ad Tracking is enabled by the user, setting ad ID to \"\"")
return adID
}
Log.d("ExampleActivity", "Limit Ad Tracking disabled; ad ID value: ${idInfo.id}")
adID = idInfo.id
} catch (e: GooglePlayServicesNotAvailableException) {
Log.d("ExampleActivity", "GooglePlayServicesNotAvailableException while retrieving the advertising identifier ${e.localizedMessage}")
} catch (e: GooglePlayServicesRepairableException) {
Log.d("ExampleActivity", "GooglePlayServicesRepairableException while retrieving the advertising identifier ${e.localizedMessage}")
} catch (e: IOException) {
Log.d("ExampleActivity", "IOException while retrieving the advertising identifier ${e.localizedMessage}")
}
Log.d("ExampleActivity", "Returning ad ID value: $adID")
return adID
}

Call site:

Copied to your clipboard
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
...
// Create background coroutine scope to fetch ad ID value
val scope = CoroutineScope(Dispatchers.IO).launch {
val adID = sharedViewModel.getGAID(context.applicationContext)
Log.d("ExampleActivity", "Sending ad ID value: $adID to MobileCore.setAdvertisingIdentifier")
MobileCore.setAdvertisingIdentifier(adID)
}

updateIdentities

Update the currently known identities within the SDK. The Identity extension will merge the received identifiers with the previously saved ones in an additive manner; no identities are removed by this API.

Identities with an empty id or namespace are not allowed and are ignored.

Updating identities using a reserved namespace is not allowed using this API. The reserved namespaces are:

  • ECID
  • IDFA
  • GAID

Java

Syntax

Copied to your clipboard
public static void updateIdentities(final IdentityMap identityMap);

Example

Copied to your clipboard
IdentityItem item = new IdentityItem("user@example.com");
IdentityMap identityMap = new IdentityMap();
identityMap.addItem(item, "Email")
Identity.updateIdentities(identityMap);

Kotlin

Example

Copied to your clipboard
val item = IdentityItem("user@example.com")
val identityMap = IdentityMap()
identityMap.addItem(item, "Email")
Identity.updateIdentities(identityMap)

Public Classes

IdentityMap

Defines a map containing a set of end user identities, keyed on either namespace integration code or the namespace ID of the identity. The values of the map are an array, meaning that more than one identity of each namespace may be carried.

The format of the IdentityMap class is defined by the XDM Identity Map Schema.

For more information, please read an overview of the Identity Service.

Copied to your clipboard
"identityMap" : {
"Email" : [
{
"id" : "user@example.com",
"authenticatedState" : "authenticated",
"primary" : false
}
],
"Phone" : [
{
"id" : "1234567890",
"authenticatedState" : "ambiguous",
"primary" : false
},
{
"id" : "5557891234",
"authenticatedState" : "ambiguous",
"primary" : false
}
],
"ECID" : [
{
"id" : "44809014977647551167356491107014304096",
"authenticatedState" : "ambiguous",
"primary" : true
}
]
}

Java

Example

Copied to your clipboard
// Construct
IdentityMap identityMap = new IdentityMap();
// Add an item
IdentityItem item = new IdentityItem("user@example.com");
identityMap.addItem(item, "Email");
// Remove an item
IdentityItem item = new IdentityItem("user@example.com");
identityMap.removeItem(item, "Email");
// Get a list of items for a given namespace
List<IdentityItem> items = identityMap.getIdentityItemsForNamespace("Email");
// Get a list of all namespaces used in current IdentityMap
List<String> namespaces = identityMap.getNamespaces();
// Check if IdentityMap has no identities
boolean hasNotIdentities = identityMap.isEmpty();

Kotlin

Example

Copied to your clipboard
// Construct
val identityMap = IdentityMap()
// Add an item
val item = IdentityItem("user@example.com")
identityMap.addItem(item, "Email")
// Remove an item
val item = IdentityItem("user@example.com")
identityMap.removeItem(item, "Email")
// Get a list of items for a given namespace
val items = identityMap.getIdentityItemsForNamespace("Email")
// Get a list of all namespaces used in current IdentityMap
val namespaces = identityMap.getNamespaces()
// Check if IdentityMap has no identities
val hasNotIdentities = identityMap.isEmpty()

IdentityItem

Defines an identity to be included in an IdentityMap.

The format of the IdentityItem class is defined by the XDM Identity Item Schema.

Java

Example

Copied to your clipboard
// Construct
IdentityItem item = new IdentityItem("identifier");
IdentityItem item = new IdentityItem("identifier", AuthenticatedState.AUTHENTICATED, false);
// Getters
String id = item.getId();
AuthenticatedState state = item.getAuthenticatedState();
boolean primary = item.isPrimary();

Kotlin

Example

Copied to your clipboard
// Construct
val item = IdentityItem("identifier")
val item = IdentityItem("identifier", AuthenticatedState.AUTHENTICATED, false)
// Getters
val id = item.id
val state = item.authenticatedState
val primary = item.isPrimary

AuthenticatedState

Defines the state an Identity Item is authenticated for.

The possible authenticated states are:

  • Ambiguous - the state is ambiguous or not defined
  • Authenticated - the user is identified by a login or similar action
  • LoggedOut - the user was identified by a login action at a previous time, but is not logged in now

Java

Syntax

Copied to your clipboard
public enum AuthenticatedState {
AMBIGUOUS("ambiguous"),
AUTHENTICATED("authenticated"),
LOGGED_OUT("loggedOut");
}

Kotlin

Syntax

Copied to your clipboard
enum class AuthenticatedState(val name: String) {
AMBIGUOUS("ambiguous"),
AUTHENTICATED("authenticated"),
LOGGED_OUT("loggedOut")
}
Was this helpful?
  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2024 Adobe. All rights reserved.