Last updated:
0 purchases
flutter aepcore
flutter_aepcore #
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.
Contents #
Installation
Usage
Initializing
Core
Identity
Lifecycle
Signal
Tests
Installation #
Install instructions for this package can be found here.
Note: After you have installed the SDK, don't forget to run pod install in your ios directory to link the libraries to your Xcode project.
Usage #
Initializing #
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.
Core #
For more detailed information on the Core APIs, visit the documentation here
Importing Core:
import 'package:flutter_aepcore/flutter_aepcore.dart';
copied to clipboard
Getting Core version:
String version = await MobileCore.extensionVersion;
copied to clipboard
Updating the SDK configuration:
MobileCore.updateConfiguration({"key" : "value"});
copied to clipboard
Clearing configuration updates back to original configuration:
MobileCore.clearUpdatedConfiguration();
copied to clipboard
Controlling the log level of the SDK:
MobileCore.setLogLevel(LogLevel.error);
MobileCore.setLogLevel(LogLevel.warning);
MobileCore.setLogLevel(LogLevel.debug);
MobileCore.setLogLevel(LogLevel.trace);
copied to clipboard
Getting the current privacy status:
PrivacyStatus result;
try {
result = await MobileCore.privacyStatus;
} on PlatformException {
log("Failed to get privacy status");
}
copied to clipboard
Setting the privacy status:
MobileCore.setPrivacyStatus(PrivacyStatus.opt_in);
MobileCore.setPrivacyStatus(PrivacyStatus.opt_out);
MobileCore.setPrivacyStatus(PrivacyStatus.unknown);
copied to clipboard
Getting the SDK identities:
String result = "";
try {
result = await MobileCore.sdkIdentities;
} on PlatformException {
log("Failed to get sdk identities");
}
copied to clipboard
Dispatching an Event Hub event:
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}''");
}
copied to clipboard
Dispatching an Event Hub event with callback:
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}''");
}
copied to clipboard
Reset identities
MobileCore.resetIdentities()
copied to clipboard
Track app actions
Important
trackAction is supported through Edge Bridge and Edge Network extensions.
MobileCore.trackAction("myAction", data: {"key1": "value1"});
copied to clipboard
Track app states
Important
trackState is supported through Edge Bridge and Edge Network extensions.
MobileCore.trackState("myState", data: {"key1": "value1"});
copied to clipboard
Identity #
For more information on the Core Identity APIs, visit the documentation here.
Importing Identity:
import 'package:flutter_aepcore/flutter_aepidentity.dart';
copied to clipboard
Getting Identity version:
String version = await Identity.extensionVersion;
copied to clipboard
Sync Identifier:
Identity.syncIdentifier("identifierType", "identifier", MobileVisitorAuthenticationState.authenticated);
copied to clipboard
Sync Identifiers:
Identity.syncIdentifiers({"idType1":"idValue1",
"idType2":"idValue2",
"idType3":"idValue3"});
copied to clipboard
Sync Identifiers with Authentication State:
Identity.syncIdentifiersWithAuthState({"idType1":"idValue1", "idType2":"idValue2", "idType3":"idValue3"}, MobileVisitorAuthenticationState.authenticated);
copied to clipboard
Note: MobileVisitorAuthenticationState is defined as:
enum MobileVisitorAuthenticationState {unknown, authenticated, logged_out}
copied to clipboard
Append visitor data to a URL:
String result = "";
try {
result = await Identity.appendToUrl("www.myUrl.com");
} on PlatformException {
log("Failed to append URL");
}
copied to clipboard
Setting the advertising identifier:
MobileCore.setAdvertisingIdentifier("ad-id");
copied to clipboard
Get visitor data as URL query parameter string:
String result = "";
try {
result = await Identity.urlVariables;
} on PlatformException {
log("Failed to get url variables");
}
copied to clipboard
Get Identifiers:
List<Identifiable> result;
try {
result = await Identity.identifiers;
} on PlatformException {
log("Failed to get identifiers");
}
copied to clipboard
Get Experience Cloud IDs:
String result = "";
try {
result = await Identity.experienceCloudId;
} on PlatformException {
log("Failed to get experienceCloudId");
}
copied to clipboard
AEPMobileVisitorId Class:
class Identifiable {
String get idOrigin;
String get idType;
String get identifier;
MobileVisitorAuthenticationState get authenticationState;
}
copied to clipboard
Lifecycle #
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.
Signal #
For more information on the Core Signal APIs, visit the documentation here
Importing Signal:
import 'package:flutter_aepcore/flutter_aepsignal.dart';
copied to clipboard
Getting Signal version:
String version = await Signal.extensionVersion;
copied to clipboard
Tests #
Run:
$ cd plugins/flutter_{plugin_name}/
$ flutter test
copied to clipboard
Contributing #
See CONTRIBUTING
License #
See LICENSE
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.