- Add the Mobile Core and Edge extensions to your project using the app's Gradle file.
Kotlin
Copied to your clipboardimplementation(platform("com.adobe.marketing.mobile:sdk-bom:3.+"))implementation("com.adobe.marketing.mobile:core")implementation("com.adobe.marketing.mobile:identity")implementation("com.adobe.marketing.mobile:edge")implementation("com.adobe.marketing.mobile:edgeidentity")
Groovy
Copied to your clipboardimplementation platform('com.adobe.marketing.mobile:sdk-bom:3.+')implementation 'com.adobe.marketing.mobile:core'implementation 'com.adobe.marketing.mobile:identity'implementation 'com.adobe.marketing.mobile:edge'implementation 'com.adobe.marketing.mobile:edgeidentity'
Using dynamic dependency versions is not recommended for production apps. Please read the managing Gradle dependencies guide for more information.
- Import the Mobile Core and Edge extensions in your application class but do not include the Identity or Identity for Edge Network extensions. Instead, use their fully qualified names during registration and when calling their APIs.
Copied to your clipboardimport com.adobe.marketing.mobile.MobileCore;import com.adobe.marketing.mobile.Edge;
- Add the Mobile Core and Edge extensions to your project using CocoaPods. Add following pods in your
Podfile
:
Copied to your clipboarduse_frameworks!target 'YourTargetApp' dopod 'AEPCore'pod 'AEPIdentity'pod 'AEPEdge'pod 'AEPEdgeIdentity'end
- Import the Mobile Core and Edge libraries:
Swift
Copied to your clipboard// AppDelegate.swiftimport AEPCoreimport AEPIdentityimport AEPEdgeimport AEPEdgeIdentity
Objective-C
Copied to your clipboard// AppDelegate.h@import AEPCore;@import AEPIdentity;@import AEPEdge;@import AEPEdgeIdentity;
Java
Copied to your clipboardpublic class MobileApp extends Application {// Set up the preferred Environment File ID from your mobile property configured in Data Collection UIprivate final String ENVIRONMENT_FILE_ID = "";@Overridepublic void onCreate() {super.onCreate();MobileCore.setApplication(this);MobileCore.configureWithAppID(ENVIRONMENT_FILE_ID);// Register Adobe Experience Platform SDK extensionsMobileCore.registerExtensions(Arrays.asList(Edge.EXTENSION,com.adobe.marketing.mobile.edge.identity.Identity.EXTENSION,com.adobe.marketing.mobile.Identity.EXTENSION),o -> Log.debug("MobileApp", "MobileApp", "Adobe Experience Platform Mobile SDK initialized."));}}
Kotlin
Copied to your clipboardclass MobileApp : Application() {// Set up the preferred Environment File ID from your mobile property configured in Data Collection UIprivate var ENVIRONMENT_FILE_ID: String = ""override fun onCreate() {super.onCreate()MobileCore.setApplication(this)MobileCore.configureWithAppID(ENVIRONMENT_FILE_ID)// Register Adobe Experience Platform SDK extensionsMobileCore.registerExtensions(listOf(Edge.EXTENSION,com.adobe.marketing.mobile.edge.identity.Identity.EXTENSION,com.adobe.marketing.mobile.Identity.EXTENSION)) {Log.debug("MobileApp", "MobileApp", "Adobe Experience Platform Mobile SDK initialized.")}}}
Swift
Copied to your clipboard// AppDelegate.swiftfunc application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {MobileCore.registerExtensions([AEPEdgeIdentity.Identity.self, AEPIdentity.Identity.self, Edge.self], {MobileCore.configureWith(appId: "yourAppId")})...}
Objective-C
Copied to your clipboard// AppDelegate.m- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {[AEPMobileCore registerExtensions:@[AEPMobileEdgeIdentity.class, AEPMobileIdentity.class, AEPMobileEdge.class] completion:^{...}];[AEPMobileCore configureWithAppId: @"yourAppId"];...}
Java
Copied to your clipboardMobileCore.setPrivacyStatus(MobilePrivacyStatus.OPT_OUT);MobileCore.resetIdentities();com.adobe.marketing.mobile.edge.identity.Identity.getExperienceCloudId(new AdobeCallback<String>() {@Overridepublic void call(String s) {// ignore}});MobileCore.setPrivacyStatus(MobilePrivacyStatus.OPT_IN);
Swift
Copied to your clipboardMobileCore.setPrivacyStatus(.optedOut)MobileCore.resetIdentities()AEPEdgeIdentity.Identity.getExperienceCloudId { _, _ in }MobileCore.setPrivacyStatus(.optedIn)
Objective-C
Copied to your clipboard[AEPMobileCore setPrivacyStatus:AEPPrivacyStatusOptedOut];[AEPMobileCore resetIdentities];[AEPMobileEdgeIdentity getExperienceCloudId:^(NSString *ecid, NSError *error) {// ignore}];[AEPMobileCore setPrivacyStatus:AEPPrivacyStatusOptedIn];