If you have implemented the older Flutter libraries (ACP-prefixed Flutter libraries) in your mobile app, then the following steps will help you migrate to the latest Flutter libraries (AEP-prefixed libraries).
Update your pubspec.yml
file to point to the new plugin as so:
...
dependencies:
- flutter_acpcore: ^2.0.0
+ flutter_aepcore: ^4.0.0
...
Updated plugins can be found in this repository under plugins/. If they are not there, they are currently not supported.
Flutter (ACP) | Flutter (AEP) |
---|---|
flutter_acpcore | flutter_aepcore |
flutter_assurance | flutter_aepassurance |
flutter_acpuserprofile | flutter_aepuserprofile |
flutter_acpanalytics | NA, Analytics workflows supported through Edge Network or Edge Bridge extensions. |
Place Services | NA |
Place Monitor | NA |
Remove the deprecated registration code and the extensions that are not supported in AEP Flutter 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.Assurance;
import com.adobe.marketing.mobile.UserProfile;
...
import android.app.Application;
import io.flutter.app.FlutterApplication;
...
public class MyApplication extends FlutterApplication {
...
@Override
public void on Create(){
super.onCreate();
...
MobileCore.setApplication(this);
MobileCore.setLogLevel(LoggingMode.DEBUG);
MobileCore.setWrapperType(WrapperType.FLUTTER);
- try {
- Identity.registerExtension();
- Lifecycle.registerExtension();
- Signal.registerExtension();
- Assurance.registerExtension();
- UserProfile.registerExtension();
- Analytics.registerExtension();
- Places.registerExtension();
- MobileCore.start(new AdobeCallback () {
- @Override
- public void call(Object o) {
- MobileCore.configureWithAppID("yourAppID");
- }
- });
- } catch (InvalidInitException e) {
List<Class<? extends Extension>> extensions = Arrays.asList(
Identity.EXTENSION,
Lifecycle.EXTENSION,
Signal.EXTENSION,
Assurance.EXTENSION,
UserProfile.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"
// 2. import AEP extensions
@import AEPCore;
@import AEPUserProfile;
@import AEPLifecycle;
@import AEPIdentity;
@import AEPServices;
@import AEPSignal;
@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];
// 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: @[
AEPMobileLifecycle.class,
AEPMobileSignal.class,
AEPMobileIdentity.class,
AEPMobileUserProfile.class,
AEPMobileAssurance.class,
] completion:^{
if (appState != UIApplicationStateBackground) {
[AEPMobileCore lifecycleStart:nil}];
}
}];
// --- 4. end ----
...
return YES;
}
@end
- (ACP)
import 'package:flutter_acpcore/flutter_acpcore.dart';
- (AEP)
import 'package:flutter_aepcore/flutter_aepcore.dart';
- (ACP)
String version = await FlutterACPCore.extensionVersion;
- (AEP)
String version = await MobileCore.extensionVersion;
- (ACP)
FlutterACPCore.updateConfiguration({"key" : "value"});
- (AEP)
MobileCore.updateConfiguration({"key" : "value"});
- (ACP)
Not supported in ACP 2.x
- (AEP)
MobileCore.clearUpdatedConfiguration();
- (ACP)
import 'package:flutter_acpcore/src/acpmobile_logging_level.dart';
FlutterACPCore.setLogLevel(ACPLoggingLevel.ERROR);
FlutterACPCore.setLogLevel(ACPLoggingLevel.WARNING);
FlutterACPCore.setLogLevel(ACPLoggingLevel.DEBUG);
FlutterACPCore.setLogLevel(ACPLoggingLevel.VERBOSE);
- (AEP)
import 'package:flutter_aepcore/flutter_aepcore_data.dart';
MobileCore.setLogLevel(LogLevel.error);
MobileCore.setLogLevel(LogLevel.warning);
MobileCore.setLogLevel(LogLevel.debug);
MobileCore.setLogLevel(LogLevel.trace);
- (ACP)
import 'package:flutter_acpcore/src/acpmobile_privacy_status.dart';
ACPPrivacyStatus result;
try {
result = await FlutterACPCore.privacyStatus;
} on PlatformException {
log("Failed to get privacy status");
}
- (AEP)
import 'package:flutter_aepcore/flutter_aepcore_data.dart';
PrivacyStatus result;
try {
result = await MobileCore.privacyStatus;
} on PlatformException {
log("Failed to get privacy status");
}
- (ACP)
import 'package:flutter_acpcore/src/acpmobile_privacy_status.dart';
FlutterACPCore.setPrivacyStatus(ACPPrivacyStatus.OPT_IN);
FlutterACPCore.setPrivacyStatus(ACPPrivacyStatus.OPT_OUT);
FlutterACPCore.setPrivacyStatus(ACPPrivacyStatus.UNKNOWN);
- (AEP)
import 'package:flutter_aepcore/flutter_aepcore_data.dart';
MobileCore.setPrivacyStatus(PrivacyStatus.opt_in);
MobileCore.setPrivacyStatus(PrivacyStatus.opt_out);
MobileCore.setPrivacyStatus(PrivacyStatus.unknown);
- (ACP)
String result = "";
try {
result = await FlutterACPCore.sdkIdentities;
} on PlatformException {
log("Failed to get sdk identities");
}
- (AEP)
String result = "";
try {
result = await MobileCore.sdkIdentities;
} on PlatformException {
log("Failed to get sdk identities");
}
- (ACP)
import 'package:flutter_acpcore/src/acpextension_event.dart';
final ACPExtensionEvent event = ACPExtensionEvent.createEvent("eventName", "eventType", "eventSource", {"testDataKey": "testDataValue"});
bool result;
try {
result = await FlutterACPCore.dispatchEvent(event);
} on PlatformException catch (e) {
log("Failed to dispatch event '${e.message}''");
}
- (AEP)
import 'package:flutter_aepcore/flutter_aepcore_data.dart';
final Event event = Event({
"eventName": "testEventName",
"eventType": "testEventType",
"eventSource": "testEventSource",
"eventData": {"eventDataKey": "eventDataValue"}
});
try {
await MobileCore.dispatchEvent(event);
} on PlatformException catch (e) {
log("Failed to dispatch event '${e.message}''");
}
- (ACP)
import 'package:flutter_acpcore/src/acpextension_event.dart';
ACPExtensionEvent result;
final ACPExtensionEvent event ACPExtensionEvent.createEvent("eventName", "eventType", "eventSource", {"testDataKey": "testDataValue"});
try {
result = await FlutterACPCore.dispatchEventWithResponseCallback(event);
} on PlatformException catch (e) {
log("Failed to dispatch event '${e.message}''");
}
- (AEP)
import 'package:flutter_aepcore/flutter_aepcore_data.dart';
Event result;
final Event event = Event({
"eventName": "testEventName",
"eventType": "testEventType",
"eventSource": "testEventSource",
"eventData": {"eventDataKey": "eventDataValue"}
});
try {
result = await MobileCore.dispatchEventWithResponseCallback(event, 1000);
} on PlatformException catch (e) {
log("Failed to dispatch event '${e.message}''");
}
- (ACP)
import 'package:flutter_acpcore/flutter_acpidentity.dart';
- (AEP)
import 'package:flutter_aepcore/flutter_aepidentity.dart';
- (ACP)
String version = await FlutterACPIdentity.extensionVersion;
- (AEP)
String version = await Identity.extensionVersion;
- (ACP)
import 'package:flutter_acpcore/src/acpmobile_visitor_id.dart';
FlutterACPIdentity.syncIdentifier("identifierType", "identifier", ACPMobileVisitorAuthenticationState.AUTHENTICATED);
- (AEP)
import 'package:flutter_aepcore/flutter_aepcore_data.dart';
Identity.syncIdentifier("identifierType", "identifier", MobileVisitorAuthenticationState.authenticated);
- (ACP)
FlutterACPIdentity.syncIdentifiers({"idType1":"idValue1",
"idType2":"idValue2",
"idType3":"idValue3"});
- (AEP)
Identity.syncIdentifiers({"idType1":"idValue1",
"idType2":"idValue2",
"idType3":"idValue3"});
- (ACP)
import 'package:flutter_acpcore/src/acpmobile_visitor_id.dart';
FlutterACPIdentity.syncIdentifiersWithAuthState({"idType1":"idValue1", "idType2":"idValue2", "idType3":"idValue3"}, ACPMobileVisitorAuthenticationState.AUTHENTICATED);
Note: ACPMobileVisitorAuthenticationState
is defined as:
enum ACPMobileVisitorAuthenticationState {UNKNOWN, AUTHENTICATED, LOGGED_OUT}
- (AEP)
import 'package:flutter_aepcore/flutter_aepcore_data.dart';
Identity.syncIdentifiersWithAuthState({"idType1":"idValue1", "idType2":"idValue2", "idType3":"idValue3"}, MobileVisitorAuthenticationState.authenticated);
Note: MobileVisitorAuthenticationState
is defined as:
enum MobileVisitorAuthenticationState {unknown, authenticated, logged_out}
- (ACP)
String result = "";
try {
result = await FlutterACPIdentity.appendToUrl("www.myUrl.com");
} on PlatformException {
log("Failed to append URL");
}
- (AEP)
String result = "";
try {
result = await Identity.appendToUrl("www.myUrl.com");
} on PlatformException {
log("Failed to append URL");
}
- (ACP)
FlutterACPCore.setAdvertisingIdentifier("ad-id");
- (AEP)
MobileCore.setAdvertisingIdentifier("ad-id");
- (ACP)
String result = "";
try {
result = await FlutterACPIdentity.urlVariables;
} on PlatformException {
log("Failed to get url variables");
}
- (AEP)
String result = "";
try {
result = await Identity.urlVariables;
} on PlatformException {
log("Failed to get url variables");
}
- (ACP)
List<ACPMobileVisitorId> result;
try {
result = await FlutterACPIdentity.identifiers;
} on PlatformException {
log("Failed to get identifiers");
}
- (AEP)
List<Identifiable> result;
try {
result = await Identity.identifiers;
} on PlatformException {
log("Failed to get identifiers");
}
- (ACP)
String result = "";
try {
result = await FlutterACPIdentity.experienceCloudId;
} on PlatformException {
log("Failed to get experienceCloudId");
}
- (AEP)
String result = "";
try {
result = await Identity.experienceCloudId;
} on PlatformException {
log("Failed to get experienceCloudId");
}
- (ACP)
import 'package:flutter_acpcore/src/acpmobile_visitor_id.dart';
class ACPMobileVisitorId {
String get idOrigin;
String get idType;
String get identifier;
ACPMobileVisitorAuthenticationState get authenticationState;
}
- (AEP)
import 'package:flutter_aepcore/flutter_aepcore_data.dart';
class Identifiable {
String get idOrigin;
String get idType;
String get identifier;
MobileVisitorAuthenticationState get authenticationState;
}
- (ACP)
import 'package:flutter_acpcore/flutter_acplifecycle.dart''
- (AEP)
import 'package:flutter_aepcore/flutter_aeplifecycle.dart''
- (ACP)
String version = await FlutterACPLifecycle.extensionVersion;
- (AEP)
String version = await Lifecycle.extensionVersion;
- (ACP)
import 'package:flutter_acpcore/flutter_acpsignal.dart';
- (AEP)
import 'package:flutter_aepcore/flutter_aepsignal.dart';
- (ACP)
String version = await FlutterACPSignal.extensionVersion;
- (AEP)
String version = await Signal.extensionVersion;
- (ACP)
import 'package:flutter_assurance/flutter_assurance.dart';
- (AEP)
import 'package:flutter_aepassurance/flutter_aepassurance.dart';
- (ACP)
String version = await FlutterAssurance.extensionVersion;
- (AEP)
String version = await Assurance.extensionVersion;
- (ACP)
FlutterAssurance.startSession(url);
- (AEP)
Assurance.startSession(url);
- (ACP)
import 'package:flutter_acpuserprofile/flutter_acpuserprofile.dart';
- (AEP)
import 'package:flutter_aepuserprofile/flutter_aepuserprofile.dart';
- (ACP)
String version = await FlutterACPUserProfile.extensionVersion;
- (AEP)
String version = await UserProfile.extensionVersion;
- (ACP)
try {
String userAttributes = await FlutterACPUserProfile.getUserAttributes(["attr1", "attr2"]);
} on PlatformException {
log("Failed to get the user attributes");
}
- (AEP)
try {
String userAttributes = await UserProfile.getUserAttributes(["attr1", "attr2"]);
} on PlatformException {
log("Failed to get the user attributes");
}
- (ACP)
FlutterACPUserProfile.removeUserAttributes(["attr1", "attr2"]);
- (AEP)
UserProfile.removeUserAttributes(["attr1", "attr2"]);
- (ACP)
FlutterACPUserProfile.updateUserAttributes({"attr1": "attr1Value", "attr2": "attr2Value"});
- (AEP)
UserProfile.updateUserAttributes({"attr1": "attr1Value", "attr2": "attr2Value"});