If you have implemented SDK's older React Native libraries (ACP-prefixed React Native libraries) 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).
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": "^6.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) | React Native (AEP) |
---|---|
@adobe/react-native-acpcore | @adobe/react-native-aepcore |
@adobe/react-native-acpuserprofile | @adobe/react-native-aepuserprofile |
@adobe/react-native-acpplaces | @adobe/react-native-aepplaces |
@adobe/react-native-acpplaces-monitor | NA |
@adobe/react-native-acpanalytics | NA, Analytics workflows supported through Edge Network or Edge Bridge extensions. Please refer to the Note below. |
@adobe/react-native-acpmedia | NA |
@adobe/react-native-acpaudience | NA |
@adobe/react-native-acptarget | @adobe/react-native-aeptarget, Analytics for Target (A4T) is not supported. If you want to use the A4T workflow, it is supported through Edge Network and Optimize extensions. |
@adobe/react-native-acpcampaign | NA |
@adobe/react-native-aepassurance:2.x (compatible with ACP libraries) | @adobe/react-native-aepassurance:4.x (compatible with AEP libraries) |
Note: Analytics library is not supported in AEP React Native. For implementing the Analytics workflow, register and configure the Edge Network or Edge Bridge libraries. Please refer to migrate to Edge Network for more info.
Remove the deprecated registration code and the 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 com.adobe.marketing.mobile.Target;
import com.adobe.marketing.mobile.Places;
import com.adobe.marketing.mobile.Assurance;
...
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();
- Assurance.registerExtension();
- MobileCore.start(new AdobeCallback () {
- @Override
- public void call(Object o) {
- MobileCore.configureWithAppID("yourAppID");
- }
- });
- } catch (InvalidInitException e) {
List<Class<? extends Extension>> extensions = Arrays.asList(
UserProfile.EXTENSION
Identity.EXTENSION,
Lifecycle.EXTENSION,
Signal.EXTENSION,
Target.EXTENSION,
Places.EXTENSION,
Assurance.EXTENSION,
);
MobileCore.registerExtensions(extensions, o -> MobileCore.configureWithAppID("YourEnvironmentFileID"));
...
}
}
}
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"
//#import "ACPTarget.h"
//#import "ACPCampaign.h"
//#import "ACPPlaces.h"
//#import "AEPAssurance.h"
// 2. import AEP extensions
@import AEPCore;
@import AEPUserProfile;
@import AEPServices;
@import AEPIdentity;
@import AEPLifecycle;
@import AEPSignal;
@import AEPTarget;
@import AEPPlaces;
@import AEPAssurance;
// --- 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];
// [ACPTarget registerExtension];
// [ACPCampaign registerExtension];
// [ACPPlaces 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"];
const UIApplicationState appState = application.applicationState;
[AEPMobileCore registerExtensions: @[
AEPMobileUserProfile.class,
AEPMobileIdentity.class,
AEPMobileLifecycle.class,
AEPMobileSignal.class,
AEPMobileTarget.class,
AEPMobilePlaces.class,
AEPMobileAssurance.class,
] completion:^{
if (appState != UIApplicationStateBackground) {
[AEPMobileCore lifecycleStart:nil];
}
}];
// --- 4. end ----
...
return YES;
}
@end
- ACP
ACPCore.collectPii(data: [String : String])
MobileCore.collectPii(data: Record<string, string>)
- ACP
ACPCore.dispatchEvent(event: ACPExtensionEvent): Promise<boolean>
MobileCore.dispatchEvent(event: Event): Promise<boolean>
- ACP
ACPCore.dispatchEventWithResponseCallback(event: ACPExtensionEvent): Promise<ACPExtensionEvent>
MobileCore.dispatchEventWithResponseCallback(event: Event, timeoutMS:Number): Promise<Event>
- ACP
ACPCore.extensionVersion(): Promise<string>
MobileCore.extensionVersion(): Promise<string>
- ACP
ACPCore.getLogLevel(): Promise<string>
MobileCore.getLogLevel(): Promise<LogLevel>
- ACP
ACPCore.getSdkIdentities(): Promise<?string>
MobileCore.getSdkIdentities(): Promise<string>
- ACP
ACPCore.getPrivacyStatus(): Promise<string>
MobileCore.getPrivacyStatus(): Promise<string>
- ACP
ACPCore.log(logLevel: string, tag: string, message: string)
-
AEP
Not Supported.
- ACP
ACPCore.resetIdentities()
MobileCore.resetIdentities()
- ACP
ACPCore.setPrivacyStatus(privacyStatus: string)
MobileCore.setPrivacyStatus(privacyStatus: string)
- ACP
ACPCore.setLogLevel(mode: string)
MobileCore.setLogLevel(mode: LogLevel)
- ACP
ACPCore.updateConfiguration(configMap?: { string: any })
MobileCore.updateConfiguration(configMap?: Record<string, any>)
- ACP
ACPIdentity.appendVisitorInfoForURL(baseURL?: String): Promise<?string>
Identity.appendVisitorInfoForURL(baseURL?: String): Promise<string>
- ACP
ACPIdentity.extensionVersion(): Promise<string>
Identity.extensionVersion(): Promise<string>
- ACP
ACPIdentity.getUrlVariables(): Promise<?string>
Identity.getUrlVariables(): Promise<string>
- ACP
ACPIdentity.getIdentifiers(): Promise<Array<?ACPVisitorID>>
Identity.getIdentifiers(): Promise<Array<VisitorID>>
- ACP
ACPIdentity.getExperienceCloudId(): Promise<?string>
Identity.getExperienceCloudId(): Promise<string>
- ACP
ACPIdentity.syncIdentifier(identifierType: String, identifier: String, authenticationState: string)
Identity.syncIdentifier(identifierType: String, identifier: String, authenticationState: MobileVisitorAuthenticationState)
- ACP
ACPIdentity.syncIdentifiers(identifiers?: { string: string })
Identity.syncIdentifiers(identifiers?: Record<string, string>)
- ACP
ACPIdentity.syncIdentifiersWithAuthState(identifiers?: { string: string }, authenticationState: string)
Identity.syncIdentifiersWithAuthState(identifiers: Record<string, string> | null, authenticationState: MobileVisitorAuthenticationState)
- ACP
ACPCore.setAdvertisingIdentifier(advertisingIdentifier?: String)
MobileCore.setAdvertisingIdentifier(advertisingIdentifier?: string)
- ACP
ACPCore.setPushIdentifier(pushIdentifier?: String)
MobileCore.setPushIdentifier(pushIdentifier?: string)
- ACP
ACPLifecycle.extensionVersion(): Promise<string>
Lifecycle.extensionVersion(): Promise<string>
- ACP
ACPSignal.extensionVersion(): Promise<string>
Signal.extensionVersion(): Promise<string>
- ACP
ACPUserProfile.extensionVersion(): Promise<string>
UserProfile.extensionVersion(): Promise<string>
- ACP
ACPUserProfile.removeUserAttribute(attributeName: string)
UserProfile.removeUserAttributes(attributeNames: Array<string>)
- ACP
ACPUserProfile.updateUserAttributes(attributeMap: { string: any })
ACPUserProfile.updateUserAttribute(attributeName: string, attributeValue: string)
UserProfile.updateUserAttributes(attributeMap: Record<string, any>)