API Reference

extensionVersion

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

Android Java

data-slots=heading, code
data-repeat=2

Syntax

public static String extensionVersion()

Example

String extensionVersion = Identity.extensionVersion();

Android Kotlin

data-slots=heading, code
data-repeat=1

Example

val extensionVersion = Identity.extensionVersion()

iOS Swift

data-slots=heading, code
data-repeat=2

Syntax

static var extensionVersion: String

Example

let extensionVersion = EdgeIdentity.extensionVersion

iOS Objective-C

data-slots=heading, code
data-repeat=2

Syntax

+ (nonnull NSString*) extensionVersion;

Example

NSString *extensionVersion = [AEPMobileEdgeIdentity 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.

data-variant=info
data-slots=text
The ECID value is returned via the AdobeCallback. When AdobeCallbackWithError is provided to this API, the timeout value is 500ms. If the operation times out or an unexpected error occurs, the fail method is called with the appropriate AdobeError.

Android Java

data-slots=heading, code
data-repeat=2

Syntax

public static void getExperienceCloudId(final AdobeCallback<String> callback);

Example

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

Android Kotlin

data-slots=heading, code
data-repeat=1

Example

Identity.getExperienceCloudId { id ->
    // Handle the ID returned here
}

iOS Swift

data-slots=heading, code
data-repeat=2

Syntax

static func getExperienceCloudId(completion: @escaping (String?, Error?) -> Void)

Example

Identity.getExperienceCloudId { (ecid, error) in
  if let error = error {
    // Handle the error here
  } else {
    // Handle the retrieved ID here
  }
}

iOS Objective-C

data-slots=heading, code
data-repeat=2

Syntax

+ (void) getExperienceCloudId:^(NSString * _Nullable ecid, NSError * _Nullable error)completion

Example

[AEPMobileEdgeIdentity getExperienceCloudId:^(NSString *ecid, NSError *error) {
    // handle the error and the retrieved ID here
}];

getIdentities

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

data-variant=info
data-slots=text
When AdobeCallbackWithError is provided, and you are fetching the identities from the Mobile SDK, the timeout value is 500ms. If the operation times out or an unexpected error occurs, the fail method is called with the appropriate AdobeError.

Android Java

data-slots=heading, code
data-repeat=2

Syntax

public static void getIdentities(final AdobeCallback<IdentityMap> callback);

Example

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

Android Kotlin

data-slots=heading, code
data-repeat=1

Example

Identity.getIdentities { identityMap ->
  // Handle the IdentityMap returned here
}

iOS Swift

data-slots=heading, code
data-repeat=2

Syntax

static func getIdentities(completion: @escaping (IdentityMap?, Error?) -> Void)

Example

Identity.getIdentities { (identityMap, error) in
  if let error = error {
    // Handle the error here
  } else {
    // Handle the retrieved identitites here
  }
}

iOS Objective-C

data-slots=heading, code
data-repeat=2

Syntax

+ (void) getIdentities:^(AEPIdentityMap * _Nullable map, NSError * _Nullable error)completion

Example

[AEPMobileEdgeIdentity getIdentities:^(AEPIdentityMap *map, NSError *error) {
    // handle the error and the retrieved ID here
}];

getUrlVariables

data-variant=info
data-slots=text
This API is available with version 1.1.0 and above.

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"

data-variant=info
data-slots=text
When AdobeCallbackWithError is provided and you are fetching the URL variables from the Mobile SDK, the timeout value is 500ms. If the operation times out or an unexpected error occurs, the fail method is called with the appropriate AdobeError.

Android Java

data-slots=heading, code
data-repeat=2

Syntax

public static void getUrlVariables(final AdobeCallback<String> callback);

Example

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);
    }
});

Android Kotlin

data-slots=heading, code
data-repeat=1

Example

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)
}

iOS Swift

data-slots=heading, code
data-repeat=2

Syntax

static func getUrlVariables(completion: @escaping (String?, Error?) -> Void)

Example

Identity.getUrlVariables { (urlVariables, error) in
  if let error = error {
    // Handle the error here
  } else {
    var urlStringWithVisitorData: String = "https://example.com"
    if let urlVariables: String = urlVariables {
      urlStringWithVisitorData.append("?" + urlVariables)
    }

    guard let urlWithVisitorData: URL = URL(string: urlStringWithVisitorData) else {
      // Handle the error, unable to construct URL
      return
    }

    // Handle the retrieved urlVariables encoded string here
    // APIs which update the UI must be called from main thread
    DispatchQueue.main.async {
        self.webView.load(URLRequest(url: urlWithVisitorData))
    }
  }
}

iOS Objective-C

data-slots=heading, code
data-repeat=2

Syntax

+ (void) getUrlVariables:^(NSString * _Nullable urlVariables, NSError * _Nullable error)completion

Example

[AEPMobileEdgeIdentity getUrlVariables:^(NSString *urlVariables, NSError *error){
  if (error) {
  // Handle the error here
  } else {
    // Handle the URL query parameter string here
    NSString* urlString = @"https://example.com";
    NSString* urlStringWithVisitorData = [NSString stringWithFormat:@"%@?%@", urlString, urlVariables];
    NSURL* urlWithVisitorData = [NSURL URLWithString:urlStringWithVisitorData];

    // APIs which update the UI must be called from main thread
    dispatch_async(dispatch_get_main_queue(), ^{
      [[self webView] loadRequest:[NSURLRequest requestWithURL:urlWithVisitorData]];
    }
  }
}];

registerExtension

data-variant=warning
data-slots=text1, text2
This API has been deprecated starting in v2.0.0 and removed in v3.0.0 of the Android mobile extension.
Use MobileCore.registerExtensions() API instead.

Android Java

data-slots=heading, code
data-repeat=2

Syntax

public static void registerExtension()

Example

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:

Android Java

data-slots=heading, code
data-repeat=2

Syntax

public static void removeIdentity(final IdentityItem item, final String namespace);

Example

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

Android Kotlin

data-slots=heading, code
data-repeat=1

Example

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

iOS Swift

data-slots=heading, code
data-repeat=2

Syntax

static func removeIdentity(item: IdentityItem, withNamespace: String)

Example

Identity.removeIdentity(item: IdentityItem(id: "user@example.com"), withNamespace: "Email")

iOS Objective-C

data-slots=heading, code
data-repeat=2

Syntax

+ (void) removeIdentityItem:(AEPIdentityItem * _Nonnull) item
                             withNamespace: (NSString * _Nonnull) namespace

Example

AEPIdentityItem *item = [[AEPIdentityItem alloc] initWithId:@"user@example.com" authenticatedState:AEPAuthenticatedStateAuthenticated primary:false];
[AEPMobileEdgeIdentity removeIdentityItem:item withNamespace:@"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:

This API is not recommended for:

data-variant=warning
data-slots=text
The Identity for Edge Network extension does not read the Mobile SDK's privacy status, and therefore setting the SDK's privacy status to opt-out will not automatically clear the identities from the Identity for Edge Network extension.

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.

data-variant=warning
data-slots=text
In order to enable collection of the user's current advertising tracking authorization selection for the provided advertising identifier, you need to install and register the AEPEdgeConsent extension and update the AEPEdge dependency to minimum 1.3.2.
data-variant=info
data-slots=text
These examples require Google Play Services to be configured in your mobile application and use the Google Mobile Ads Lite SDK. For instructions on how to import the SDK and configure your ApplicationManifest.xml file see Google Mobile Ads Lite SDK setup. For more information about advertising identifiers and how to handle them correctly in your mobile application see Google Play Services documentation about AdvertisingIdClient.

Android Java

data-slots=heading, code
data-repeat=2

Syntax

public static void setAdvertisingIdentifier(final String advertisingIdentifier);

Example

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();
}

Android Kotlin

data-slots=heading, code
data-repeat=1

Example

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:

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)
}

iOS Swift

In order to enable the collection of current advertising tracking user's selection based on the provided advertising identifier, you need to install and register the Consent for Edge Network extension and update the Edge Network extension dependency to minimum 1.4.1.

Starting from iOS 14+, applications must use the App Tracking Transparency framework to request user authorization before using the Identifier for Advertising (IDFA). To access IDFA and handle it correctly in your mobile application, see the Apple developer documentation about IDFA.

data-slots=heading, code
data-repeat=2

Syntax

@objc(setAdvertisingIdentifier:)
public static func setAdvertisingIdentifier(_ identifier: String?)

Example

import AdSupport
import AppTrackingTransparency
...

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    ...
    if #available(iOS 14, *) {
       setAdvertisingIdentifierUsingTrackingManager()
    } else {
       // Fallback on earlier versions
       setAdvertisingIdentifierUsingIdentifierManager()
    }

}

func setAdvertisingIdentifierUsingIdentifierManager() {
    var idfa:String = "";
        if (ASIdentifierManager.shared().isAdvertisingTrackingEnabled) {
            idfa = ASIdentifierManager.shared().advertisingIdentifier.uuidString;
        } else {
            Log.debug(label: "AppDelegateExample",
                      "Advertising Tracking is disabled by the user, cannot process the advertising identifier.");
        }
        MobileCore.setAdvertisingIdentifier(idfa);
}

@available(iOS 14, *)
func setAdvertisingIdentifierUsingTrackingManager() {
    ATTrackingManager.requestTrackingAuthorization { (status) in
        var idfa: String = "";

        switch (status) {
        case .authorized:
            idfa = ASIdentifierManager.shared().advertisingIdentifier.uuidString
        case .denied:
            Log.debug(label: "AppDelegateExample",
                      "Advertising Tracking is denied by the user, cannot process the advertising identifier.")
        case .notDetermined:
            Log.debug(label: "AppDelegateExample",
                      "Advertising Tracking is not determined, cannot process the advertising identifier.")
        case .restricted:
            Log.debug(label: "AppDelegateExample",
                      "Advertising Tracking is restricted by the user, cannot process the advertising identifier.")
        }

        MobileCore.setAdvertisingIdentifier(idfa)
    }
}

iOS Objective-C

data-slots=heading, code
data-repeat=2

Syntax

+ (void) setAdvertisingIdentifier: (NSString * _Nullable identifier);

Example

#import <AdSupport/ASIdentifierManager.h>
#import <AppTrackingTransparency/ATTrackingManager.h>
...

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
-   ...
-
    if (@available(iOS 14, *)) {
        [self setAdvertisingIdentifierUsingTrackingManager];
    } else {
        // fallback to earlier versions
        [self setAdvertisingIdentifierUsingIdentifierManager];
    }

}

- (void) setAdvertisingIdentifierUsingIdentifierManager {
    // setup the advertising identifier
    NSString *idfa = nil;
    if ([[ASIdentifierManager sharedManager] isAdvertisingTrackingEnabled]) {
        idfa = [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString];
    } else {
        [AEPLog debugWithLabel:@"AppDelegateExample"
                       message:@"Advertising Tracking is disabled by the user, cannot process the advertising identifier"];
    }
    [AEPMobileCore setAdvertisingIdentifier:idfa];

}

- (void) setAdvertisingIdentifierUsingTrackingManager API_AVAILABLE(ios(14)) {
    [ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:
    ^(ATTrackingManagerAuthorizationStatus status){
        NSString *idfa = nil;
        switch(status) {
            case ATTrackingManagerAuthorizationStatusAuthorized:
                idfa = [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString];
                break;
            case ATTrackingManagerAuthorizationStatusDenied:
                [AEPLog debugWithLabel:@"AppDelegateExample"
                               message:@"Advertising Tracking is denied by the user, cannot process the advertising identifier"];
                break;
            case ATTrackingManagerAuthorizationStatusNotDetermined:
                [AEPLog debugWithLabel:@"AppDelegateExample"
                               message:@"Advertising Tracking is not determined, cannot process the advertising identifier"];
                break;
            case ATTrackingManagerAuthorizationStatusRestricted:
                [AEPLog debugWithLabel:@"AppDelegateExample"
                               message:@"Advertising Tracking is restricted by the user, cannot process the advertising identifier"];
                break;
        }

        [AEPMobileCore setAdvertisingIdentifier:idfa];
    }];
}

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:

Android Java

data-slots=heading, code
data-repeat=2

Syntax

public static void updateIdentities(final IdentityMap identityMap);

Example

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

Android Kotlin

data-slots=heading, code
data-repeat=1

Example

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

iOS Swift

data-slots=heading, code
data-repeat=2

Syntax

static func updateIdentities(with map: IdentityMap)

Example

let identityMap = IdentityMap()
identityMap.addItem(item: IdentityItem(id: "user@example.com"), withNamespace: "Email")
Identity.updateIdentities(with: identityMap)

iOS Objective-C

data-slots=heading, code
data-repeat=2

Syntax

+ (void) updateIdentities:(AEPIdentityMap * _Nonnull)map

Example

AEPIdentityItem *item = [[AEPIdentityItem alloc] initWithId:@"user@example.com" authenticatedState:AEPAuthenticatedStateAuthenticated primary:false];
AEPIdentityMap *map = [[AEPIdentityMap alloc] init];
[map addItem:item withNamespace:@"Email"];
[AEPMobileEdgeIdentity updateIdentities:map];

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.

"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
      }
    ]
  }

Android Java

// 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();

Android Kotlin

// 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()

iOS Swift

// Initialize
let identityMap: IdentityMap = IdentityMap()

// Add an item
identityMap.add(item: IdentityItem(id: "user@example.com"), withNamespace: "Email")

// Remove an item
identityMap.remove(item: IdentityItem(id: "user@example.com", withNamespace: "Email"))

// Get a list of items for a given namespace
let items: [IdentityItem] = identityMap.getItems(withNamespace: "Email")

// Get a list of all namespaces used in current IdentityMap
let namespaces: [String] = identityMap.namespaces

// Check if IdentityMap has no identities
let hasNoIdentities: Bool = identityMap.isEmpty

iOS Objective-C

// Initialize
AEPIdentityMap* identityMap = [[AEPIdentityMap alloc] init];

// Add an item
AEPIdentityItem* item = [[AEPIdentityItem alloc] initWithId:@"user@example.com" authenticatedState:AEPAuthenticatedStateAuthenticated primary:false];
[identityMap addItem:item withNamespace:@"Email"];

// Remove an item
AEPIdentityItem* item = [[AEPIdentityItem alloc] initWithId:@"user@example.com" authenticatedState:AEPAuthenticatedStateAuthenticated primary:false];
[identityMap removeItem:item withNamespace:@"Email"];

// Get a list of items for a given namespace
NSArray<AEPIdentityItem*>* items = [identityMap getItemsWithNamespace:@"Email"];

// Get a list of all namespaces used in current IdentityMap
NSArray<NSString*>* namespaces = identityMap.namespaces;

// Check if IdentityMap has no identities
bool hasNoIdentities = 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.

Android Java

// 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();

Android Kotlin

// 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

iOS Swift

// Initialize
let item = IdentityItem(id: "identifier")

let item = IdentityItem(id: "identifier", authenticatedState: .authenticated, primary: false)

// Getters
let id: String = item.id

let state: AuthenticatedState = item.authenticatedState

let primary: Bool = item.primary

iOS Objective-C

// Initialize
AEPIdentityItem* item = [[AEPIdentityItem alloc] initWithId:@"identity" authenticatedState:AEPAuthenticatedStateAuthenticated primary:false];

// Getters
NSString* id = primaryEmail.id;

long state = primaryEmail.authenticatedState;

bool primary = primaryEmail.primary;

AuthenticatedState

Defines the state an Identity Item is authenticated for.

The possible authenticated states are:

Android Java

data-slots=heading, code
data-repeat=1

Syntax

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

Android Kotlin

data-slots=heading, code
data-repeat=1

Syntax

enum class AuthenticatedState(val name: String) {
    AMBIGUOUS("ambiguous"),
    AUTHENTICATED("authenticated"),
    LOGGED_OUT("loggedOut")
}

iOS Swift

data-slots=heading, code
data-repeat=1

Syntax

@objc(AEPAuthenticatedState)
public enum AuthenticatedState: Int, RawRepresentable, Codable {
    case ambiguous = 0
    case authenticated = 1
    case loggedOut = 2
}