If using Gradle, remove the v4 Mobile SDK dependency:
Gradle
Copied to your clipboarddependencies {implementation 'com.adobe.mobile:adobeMobileLibrary:4.18.2'...}
Alternatively, if the v4 Mobile SDK library is linked as a jar, search for adobeMobileLibrary
in your project and remove the jar file.
If using Cocoapods, remove the v4 Mobile SDK dependency from the Podfile:
Copied to your clipboardtarget 'YourTarget' dopod 'AdobeMobileSDK'...end
Alternatively, if the v4 Mobile SDK library is linked in Xcode, select the application target and go to Build Phases
, then Link Binary With Libraries
and remove AdobeMobileLibrary.a
.
Java
Copied to your clipboardimport com.adobe.marketing.mobile.MobileCore;import com.adobe.marketing.mobile.Analytics;import com.adobe.marketing.mobile.Identity;@Overridepublic void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.main);MobileCore.setApplication(getApplication());MobileCore.registerExtensions(Arrays.asList(Analytics.EXTENSION,Identity.EXTENSION), value -> {// add your Environment file ID from Environments tab in Data Collection tags.MobileCore.configureWithAppID("your-environment-file-id");});}
Swift
Copied to your clipboardimport AEPCoreimport AEPIdentityimport AEPAnalyticsfunc application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {MobileCore.registerExtensions([Analytics.self, Identity.self], {// Use the environment file id assigned to this application in Data Collection UIMobileCore.configureWith(appId: "your-environment-file-id")})return true}
Objective-C
Copied to your clipboard// AppDelegate.h@import AEPCore;@import AEPIdentity;@import AEPAnalytics;// AppDelegate.m- (BOOL) application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {[AEPMobileCore registerExtensions:@[AEPMobileAnalytics.class, AEPMobileIdentity.class] completion:^{// Use the environment file id assigned to this application in Data Collection UI[AEPMobileCore configureWithAppId: @"your-environment-file-id"];}];return YES;}
Java
The Adobe Mobile Library (v4) syntax and usage examples for these API are:
Copied to your clipboard// syntaxpublic static void trackState(final String state, final Map<String, Object> contextData)// usageAnalytics.trackState("MainPage", new HashMap<String, Object>() {{put("firstVisit", true);}});
Copied to your clipboard// syntaxpublic static void trackAction(final String action, final Map<String, Object> contextData)// usageAnalytics.trackAction("linkClicked", new HashMap<String, Object>() {{put("url", "https://www.adobe.com");}});
Objective-C
The Adobe Mobile Library (v4) syntax and usage examples for these API are:
Copied to your clipboard// syntax+ (void) trackState:(NSString *)state data:(NSDictionary *)data;// usage[ADBMobile trackState:@"MainPage" data:@{@"firstVisit":@true}];
Copied to your clipboard// syntax+ (void) trackAction:(NSString *)action data:(NSDictionary *)data;// usage[ADBMobile trackAction:@"linkClicked" data:@{@"url":@"https://www.adobe.com"}];
The Mobile SDKs have moved the trackAction
and trackState
APIs to the MobileCore extension. In addition, the context data Map has been changed from <String, Object>
to <String, String>
. The syntax is:
Java
Copied to your clipboard// syntaxpublic static void trackState(final String state, final Map<String, String> contextData)// usageMobileCore.trackState("MainPage", new HashMap<String, String>() {{put("firstVisit", "true");}});
Copied to your clipboard// syntaxpublic static void trackAction(final String action, final Map<String, String> contextData)// usageMobileCore.trackAction("linkClicked", new HashMap<String, String>() {{put("url", "https://www.adobe.com");}});
The Mobile SDKs have moved the trackAction
and trackState
APIs to the MobileCore extension. The syntax is:
Copied to your clipboard@objc(trackAction:data:)static func track(action: String?, data: [String: Any]?)
Copied to your clipboard@objc(trackState:data:)static func track(state: String?, data: [String: Any]?)
The usage examples are:
Swift
Copied to your clipboardMobileCore.track(state: "MainPage", data: ["firstVisit": "true"])MobileCore.track(action: "linkClicked", data: ["url": "https://www.adobe.com"])
Objective-C
Copied to your clipboard[AEPMobileCore trackState:@"MainPage" data:@{@"firstVisit":@"true"}];[AEPMobileCore trackAction:@"linkClicked" data:@{@"url":@"https://www.adobe.com"}];
Java
The usage example for the setPrivacyStatus
API is:
Copied to your clipboardMobileCore.setPrivacyStatus(MobilePrivacyStatus.OPT_IN);MobileCore.setPrivacyStatus(MobilePrivacyStatus.OPT_OUT);MobileCore.setPrivacyStatus(MobilePrivacyStatus.UNKNOWN);
The usage example for the getPrivacyStatus
API is:
Copied to your clipboardMobileCore.getPrivacyStatus(new AdobeCallback<MobilePrivacyStatus>() {@Overridepublic void call(MobilePrivacyStatus status) {// handle current privacy status}});
The usage example for getPrivacyStatus
is:
Swift
Copied to your clipboardMobileCore.getPrivacyStatus(completion: ({ status in// handle current privacy statusswitch status {case PrivacyStatus.optedIn: print("Privacy Status: Opt-In")case PrivacyStatus.optedOut: print("Privacy Status: Opt-Out")case PrivacyStatus.unknown: print("Privacy Status: Unknown")default: break}})
Objective-C
Copied to your clipboard[AEPMobileCore getPrivacyStatus:^(AEPPrivacyStatus status) {switch (status) {case AEPPrivacyStatusOptedIn: NSLog(@"Privacy Status: Opt-In");case AEPPrivacyStatusOptedOut: NSLog(@"Privacy Status: Opt-Out");case AEPPrivacyStatusUnknown: NSLog(@"Privacy Status: Unknown");default: break;}}];