flutter_aepcore
is a flutter plugin for the iOS and Android AEP Core SDK to allow for integration with flutter applications. Functionality to enable the Core extension is provided entirely through Dart documented below.
Install instructions for this package can be found here.
Note: After you have installed the SDK, don't forget to run
pod install
in yourios
directory to link the libraries to your Xcode project.
Initializing the SDK should be done in native code (AppDelegate / SceneDelegate for iOS and Application class for Android). Documentation for initializing the SDK can be found here.
As part of the initialization code, make sure that you set the SDK wrapper type to Flutter
before you start the SDK.
Refer to the Initialization section of the root README for more information about initializing the SDK.
For more detailed information on the Core APIs, visit the documentation here
import 'package:flutter_aepcore/flutter_aepcore.dart';
String version = await MobileCore.extensionVersion;
MobileCore.updateConfiguration({"key" : "value"});
MobileCore.clearUpdatedConfiguration();
MobileCore.setLogLevel(LogLevel.error);
MobileCore.setLogLevel(LogLevel.warning);
MobileCore.setLogLevel(LogLevel.debug);
MobileCore.setLogLevel(LogLevel.trace);
PrivacyStatus result;
try {
result = await MobileCore.privacyStatus;
} on PlatformException {
log("Failed to get privacy status");
}
MobileCore.setPrivacyStatus(PrivacyStatus.opt_in);
MobileCore.setPrivacyStatus(PrivacyStatus.opt_out);
MobileCore.setPrivacyStatus(PrivacyStatus.unknown);
String result = "";
try {
result = await MobileCore.sdkIdentities;
} on PlatformException {
log("Failed to get sdk identities");
}
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}''");
}
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}''");
}
MobileCore.resetIdentities()
Important
trackAction is supported through Edge Bridge and Edge Network extensions.
MobileCore.trackAction("myAction", data: {"key1": "value1"});
Important
trackState is supported through Edge Bridge and Edge Network extensions.
MobileCore.trackState("myState", data: {"key1": "value1"});
For more information on the Core Identity APIs, visit the documentation here.
import 'package:flutter_aepcore/flutter_aepidentity.dart';
String version = await Identity.extensionVersion;
Identity.syncIdentifier("identifierType", "identifier", MobileVisitorAuthenticationState.authenticated);
Identity.syncIdentifiers({"idType1":"idValue1",
"idType2":"idValue2",
"idType3":"idValue3"});
Identity.syncIdentifiersWithAuthState({"idType1":"idValue1", "idType2":"idValue2", "idType3":"idValue3"}, MobileVisitorAuthenticationState.authenticated);
Note: MobileVisitorAuthenticationState
is defined as:
enum MobileVisitorAuthenticationState {unknown, authenticated, logged_out}
String result = "";
try {
result = await Identity.appendToUrl("www.myUrl.com");
} on PlatformException {
log("Failed to append URL");
}
MobileCore.setAdvertisingIdentifier("ad-id");
String result = "";
try {
result = await Identity.urlVariables;
} on PlatformException {
log("Failed to get url variables");
}
List<Identifiable> result;
try {
result = await Identity.identifiers;
} on PlatformException {
log("Failed to get identifiers");
}
String result = "";
try {
result = await Identity.experienceCloudId;
} on PlatformException {
log("Failed to get experienceCloudId");
}
class Identifiable {
String get idOrigin;
String get idType;
String get identifier;
MobileVisitorAuthenticationState get authenticationState;
}
For more information on the Core Lifecycle APIs, visit the documentation here
Note: It is required to implement Lifecycle in native Android and iOS code.
For more information on the Core Signal APIs, visit the documentation here
import 'package:flutter_aepcore/flutter_aepsignal.dart';
String version = await Signal.extensionVersion;
Run:
$ cd plugins/flutter_{plugin_name}/
$ flutter test
See CONTRIBUTING
See LICENSE