Skip to content

Latest commit

 

History

History
196 lines (137 loc) · 3.75 KB

api-reference.md

File metadata and controls

196 lines (137 loc) · 3.75 KB

Identity API Usage

This document lists the APIs provided by Identity extension, along with sample code snippets on how to properly use the APIs.

For more in-depth information about the Identity extension, visit the official SDK documentation on Identity.

Registering Identity extension

Identity.EXTENSION represents a reference to the IdentityExtension class that can be registered with MobileCore via its registerExtensions api.

Java
import com.adobe.marketing.mobile.Identity;

MobileCore.registerExtensions(Arrays.asList(Identity.EXTENSION, ...), new AdobeCallback<Object>() {
    // handle callback
});
Kotlin
import com.adobe.marketing.mobile.Identity

MobileCore.registerExtensions(Arrays.asList(Identity.EXTENSION, ...)){
    // handle callback
}

Getting Identity extension version

Java
final String identityExtensionVersion = Identity.extensionVersion();
Kotlin
val identityExtensionVersion: String = Identity.extensionVersion()

Append visitor data to a URL

Java
Identity.appendVisitorInfoForURL("https://example.com", new AdobeCallback<String>() {    
    @Override    
    public void call(String urlWithAdobeVisitorInfo) {        
        //handle callback    
    }
});
Kotlin
Identity.appendVisitorInfoForURL("https://example.com"){ urlWithAdobeVisitorInfo ->
    // handle callback
}

Get URL Variables

Java
Identity.getUrlVariables(new AdobeCallback<String>() {    
    @Override    
    public void call(String stringWithAdobeVisitorInfo) {        
        //handle callaback    
    }
});
Kotlin
Identity.getUrlVariables{ stringWithAdobeVisitorInfo ->
    // handle callback
}

Get Identifiers

Java
Identity.getIdentifiers(new AdobeCallback<List<VisitorID>>() {    
    @Override    
    public void call(List<VisitorID> idList) {        
         // handle callback
    }

});
Kotlin
Identity.getIdentifiers{ idList ->
    // handle callback
}

Get Experience Cloud ID

Java
Identity.getExperienceCloudId(new AdobeCallback<String>() {    
    @Override    
    public void call(String experienceCloudId) {        
         //handle callback
    }
});
Kotlin
Identity.getExperienceCloudId{ experienceCloudId ->
    //handle callback
}

Sync Identifier

Java
Identity.syncIdentifier("idType", "idValue", VisitorID.AuthenticationState.AUTHENTICATED);
Kotlin
Identity.syncIdentifier("idType", "idValue", VisitorID.AuthenticationState.AUTHENTICATED)

Sync Identifiers

Java
final Map<String, String> identifiers = new HashMap<>();
identifiers.put("idType1", "idValue1");
identifiers.put("idType2", "idValue2");
identifiers.put("idType3", "idValue3");
Identity.syncIdentifiers(identifiers);
Kotlin
val identifiers: Map<String, String?> = mapOf(
    "idType1" to "idValue1",
    "idType2" to "idValue2",
    "idType3" to "idValue3"
)
Identity.syncIdentifiers(identifiers);

Sync Identifiers with Authentication State

Java
final Map<String, String> identifiers = new HashMap<>();
identifiers.put("idType1", "idValue1");
identifiers.put("idType2", "idValue2");
identifiers.put("idType3", "idValue3");
Identity.syncIdentifiers(identifiers, VisitorID.AuthenticationState.AUTHENTICATED);
Kotlin
val identifiers: Map<String, String?> = mapOf(
    "idType1" to "idValue1",
    "idType2" to "idValue2",
    "idType3" to "idValue3"
)
Identity.syncIdentifiers(identifiers, VisitorID.AuthenticationState.AUTHENTICATED);