If you have implemented SDK's older React Native libraries (ACP-prefixed React Native libraries, 2.x or lower) in your mobile app, then the following steps will help you migrate your implementation to the latest React Native libraries(AEP-prefixed React Native libraries, 1.x or higher).
Open your app's package.json file and replace the ACP-prefixed packages with the corresponding AEP-prefixed packages. For example, the following code snippet shows the changes for core
library:
...
"dependencies": {
"react-native": "0.64.2",
- "@adobe/react-native-acpcore": "^2.0.0"
+ "@adobe/react-native-aepcore": "^1.0.0",
...
},
At this time, the following ACP-prefix libraries can be switched out with their respective AEP-prefix libraries. However, ACP and AEP React Native libraries are not compatible. For extensions not supported in AEP-prefixed libraries, you should remove those packages from your package.json file.
React Native (ACP 2.x) | React Native (AEP 1.x) |
---|---|
@adobe/react-native-acpcore | @adobe/react-native-aepcore |
@adobe/react-native-acpuserprofile | @adobe/react-native-aepuserprofile |
@adobe/react-native-acpplaces | NA |
@adobe/react-native-acpplaces-monitor | NA |
@adobe/react-native-acpanalytics | NA |
@adobe/react-native-acpmedia | NA |
@adobe/react-native-acpaudience | NA |
@adobe/react-native-acptarget | NA |
@adobe/react-native-acpcampaign | NA |
@adobe/react-native-aepassurance:2.x (compatible with ACP libraries) | @adobe/react-native-aepassurance:3.x (compatible with AEP libraries) |
Remove the registration code for extensions that are not supported in AEP React Native libraries.
import com.adobe.marketing.mobile.AdobeCallback;
import com.adobe.marketing.mobile.Identity;
import com.adobe.marketing.mobile.InvalidInitException;
import com.adobe.marketing.mobile.Lifecycle;
import com.adobe.marketing.mobile.LoggingMode;
import com.adobe.marketing.mobile.MobileCore;
import com.adobe.marketing.mobile.Signal;
import com.adobe.marketing.mobile.UserProfile;
...
import android.app.Application;
...
public class MainApplication extends Application implements ReactApplication {
...
@Override
public void on Create(){
super.onCreate();
...
MobileCore.setApplication(this);
MobileCore.setLogLevel(LoggingMode.DEBUG);
- MobileCore.setWrapperType(WrapperType.REACT_NATIVE);
try {
UserProfile.registerExtension();
Identity.registerExtension();
Lifecycle.registerExtension();
Signal.registerExtension();
- Analytics.registerExtension();
- Target.registerExtension();
- Places.registerExtension();
- Campaign.registerExtension();
MobileCore.start(new AdobeCallback () {
@Override
public void call(Object o) {
MobileCore.configureWithAppID("yourAppID");
}
});
} catch (InvalidInitException e) {
...
}
}
}
Note: For iOS app, after installing the AEP-prefixed packages, please update native dependecies by running the following command:
cd ios && pod update && cd ..
// 1. remove the following header files
//#import "ACPCore.h"
//#import "ACPUserProfile.h"
//#import "ACPIdentity.h"
//#import "ACPLifecycle.h"
//#import "ACPSignal.h"
// 2. import AEP extensions
@import AEPCore;
@import AEPServices;
@import AEPSignal;
@import AEPLifecycle;
// --- 2. end ----
...
@implementation AppDelegate
-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// 3. remove the following code for initializing ACP SDKs
// [ACPCore setLogLevel:ACPMobileLogLevelDebug];
// [ACPCore configureWithAppId:@"yourAppID"];
// [ACPUserProfile registerExtension];
// [ACPIdentity registerExtension];
// [ACPLifecycle registerExtension];
// [ACPSignal registerExtension];
// [ACPAnalytics registerExtension];
// [ACPCampaign registerExtension];
// [ACPTarget registerExtension];
// const UIApplicationState appState = application.applicationState;
// [ACPCore start:^{
// if (appState != UIApplicationStateBackground) {
// [ACPCore lifecycleStart:nil];
// }
// }];
// 4. add code to initializing AEP SDKs
[AEPMobileCore setLogLevel: AEPLogLevelDebug];
[AEPMobileCore configureWithAppId:@"yourAppID"];
[AEPMobileCore registerExtensions: @[
AEPMobileLifecycle.class,
AEPMobileSignal.class,
AEPMobileIdentity.class,
AEPMobileUserProfile.class,
] completion:^{
[AEPMobileCore lifecycleStart:@{@"contextDataKey": @"contextDataVal"}];
}
];
// --- 4. end ----
...
return YES;
}
@end
- ACP (2.x)
ACPCore.collectPii(data: [String : String])
MobileCore.collectPii(data: Record<string, string>)
- ACP (2.x)
ACPCore.dispatchEvent(event: ACPExtensionEvent): Promise<boolean>
MobileCore.dispatchEvent(event: Event): Promise<boolean>
- ACP (2.x)
ACPCore.dispatchEventWithResponseCallback(event: ACPExtensionEvent): Promise<ACPExtensionEvent>
MobileCore.dispatchEventWithResponseCallback(event: Event): Promise<Event>
- ACP (2.x)
ACPCore.extensionVersion(): Promise<string>
MobileCore.extensionVersion(): Promise<string>
- ACP (2.x)
ACPCore.getLogLevel(): Promise<string>
MobileCore.getLogLevel(): Promise<LogLevel>
- ACP (2.x)
ACPCore.getSdkIdentities(): Promise<?string>
MobileCore.getSdkIdentities(): Promise<string>
- ACP (2.x)
ACPCore.getPrivacyStatus(): Promise<string>
MobileCore.getPrivacyStatus(): Promise<string>
- ACP (2.x)
ACPCore.log(logLevel: string, tag: string, message: string)
MobileCore.log(logLevel: LogLevel, tag: string, message: string)
- ACP (2.x)
ACPCore.resetIdentities()
MobileCore.resetIdentities()
- ACP (2.x)
ACPCore.setPrivacyStatus(privacyStatus: string)
MobileCore.setPrivacyStatus(privacyStatus: string)
- ACP (2.x)
ACPCore.setLogLevel(mode: string)
MobileCore.setLogLevel(mode: LogLevel)
- ACP (2.x)
ACPCore.updateConfiguration(configMap?: { string: any })
MobileCore.updateConfiguration(configMap?: Record<string, any>)
- ACP (2.x)
ACPIdentity.appendVisitorInfoForURL(baseURL?: String): Promise<?string>
Identity.appendVisitorInfoForURL(baseURL?: String): Promise<string>
- ACP (2.x)
ACPIdentity.extensionVersion(): Promise<string>
Identity.extensionVersion(): Promise<string>
- ACP (2.x)
ACPIdentity.getUrlVariables(): Promise<?string>
Identity.getUrlVariables(): Promise<string>
- ACP (2.x)
ACPIdentity.getIdentifiers(): Promise<Array<?ACPVisitorID>>
Identity.getIdentifiers(): Promise<Array<VisitorID>>
- ACP (2.x)
ACPIdentity.getExperienceCloudId(): Promise<?string>
Identity.getExperienceCloudId(): Promise<string>
- ACP (2.x)
ACPIdentity.syncIdentifier(identifierType: String, identifier: String, authenticationState: string)
Identity.syncIdentifier(identifierType: String, identifier: String, authenticationState: MobileVisitorAuthenticationState)
- ACP (2.x)
ACPIdentity.syncIdentifiers(identifiers?: { string: string })
Identity.syncIdentifiers(identifiers?: Record<string, string>)
- ACP (2.x)
ACPIdentity.syncIdentifiersWithAuthState(identifiers?: { string: string }, authenticationState: string)
Identity.syncIdentifiersWithAuthState(identifiers: Record<string, string> | null, authenticationState: MobileVisitorAuthenticationState)
- ACP (2.x)
ACPCore.setAdvertisingIdentifier(advertisingIdentifier?: String)
MobileCore.setAdvertisingIdentifier(advertisingIdentifier?: string)
- ACP (2.x)
ACPCore.setPushIdentifier(pushIdentifier?: String)
MobileCore.setPushIdentifier(pushIdentifier?: string)
- ACP (2.x)
ACPLifecycle.extensionVersion(): Promise<string>
Lifecycle.extensionVersion(): Promise<string>
- ACP (2.x)
ACPSignal.extensionVersion(): Promise<string>
Signal.extensionVersion(): Promise<string>
- ACP (2.x)
ACPUserProfile.extensionVersion(): Promise<string>
UserProfile.extensionVersion(): Promise<string>
- ACP (2.x)
ACPUserProfile.removeUserAttribute(attributeName: string)
UserProfile.removeUserAttributes(attributeNames: Array<string>)
- ACP (2.x)
ACPUserProfile.updateUserAttributes(attributeMap: { string: any })
ACPUserProfile.updateUserAttribute(attributeName: string, attributeValue: string)
UserProfile.updateUserAttributes(attributeMap: Record<string, any>)