flutter_acpcore
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.
After you have installed Core, you can install additional AEP Flutter extensions.
Extension | Package |
---|---|
Analytics | |
Assurance |
Run:
flutter test
Initializing the SDK should be done in native code, documentation on how to initalize the SDK can be found here. The linked documentation initalizes the User Profile extension which is not required or supported in Flutter.
Add the initialization code in AppDelegate.m or AppDelegate.swift file of the generated iOS project.
Create an Application class which extends FlutterApplication and add the initialization code. Change your AndroidManifest.xml to reference this new class.
Once you have added the initialization code to your app, be sure to set the SDK wrapper type to Flutter before you start the SDK.
Swift:
ACPCore.setWrapperType(.flutter)
Objective-C:
[ACPCore setWrapperType:ACPMobileWrapperTypeFlutter];
MobileCore.setWrapperType(WrapperType.FLUTTER);
import 'package:flutter_acpcore/flutter_acpcore.dart';
String version = await FlutterACPCore.extensionVersion;
FlutterACPCore.updateConfiguration({"key" : "value"});
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);
import 'package:flutter_acpcore/src/acpmobile_privacy_status.dart';
ACPPrivacyStatus result;
try {
result = await FlutterACPCore.privacyStatus;
} on PlatformException {
log("Failed to get privacy status");
}
import 'package:flutter_acpcore/src/acpmobile_privacy_status.dart';
FlutterACPCore.setPrivacyStatus(ACPPrivacyStatus.OPT_IN);
FlutterACPCore.setPrivacyStatus(ACPPrivacyStatus.OPT_OUT);
FlutterACPCore.setPrivacyStatus(ACPPrivacyStatus.UNKNOWN);
String result = "";
try {
result = await FlutterACPCore.sdkIdentities;
} on PlatformException {
log("Failed to get sdk identities");
}
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}''");
}
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}''");
}
import 'package:flutter_acpcore/src/acpextension_event.dart';
bool result;
final ACPExtensionEvent responseEvent = ACPExtensionEvent.createEvent("eventName", "eventType", "eventSource", {"testDataKey": "testDataValue"});
final ACPExtensionEvent requestEvent = ACPExtensionEvent.createEvent("eventName", "eventType", "eventSource", {"testDataKey": "testDataValue"});
try {
result = await FlutterACPCore.dispatchResponseEvent(responseEvent, requestEvent);
} on PlatformException catch (e) {
log("Failed to dispatch events '${e.message}''");
}
import 'package:flutter_acpcore/flutter_acpidentity.dart';
String version = await FlutterACPIdentity.extensionVersion;
import 'package:flutter_acpcore/src/acpmobile_visitor_id.dart';
FlutterACPIdentity.syncIdentifier("identifierType", "identifier", ACPMobileVisitorAuthenticationState.AUTHENTICATED);
FlutterACPIdentity.syncIdentifiers({"idType1":"idValue1",
"idType2":"idValue2",
"idType3":"idValue3"});
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}
String result = "";
try {
result = await FlutterACPIdentity.appendToUrl("www.myUrl.com");
} on PlatformException {
log("Failed to append URL");
}
FlutterACPCore.setAdvertisingIdentifier("ad-id");
String result = "";
try {
result = await FlutterACPIdentity.urlVariables;
} on PlatformException {
log("Failed to get url variables");
}
List<ACPMobileVisitorId> result;
try {
result = await FlutterACPIdentity.identifiers;
} on PlatformException {
log("Failed to get identifiers");
}
String result = "";
try {
result = await FlutterACPIdentity.experienceCloudId;
} on PlatformException {
log("Failed to get experienceCloudId");
}
import 'package:flutter_acpcore/src/acpmobile_visitor_id.dart';
class ACPMobileVisitorId {
String get idOrigin;
String get idType;
String get identifier;
ACPMobileVisitorAuthenticationState get authenticationState;
}
Note: It is required to implement Lifecycle in native Android and iOS code.
import 'package:flutter_acpcore/flutter_acpsignal.dart';
String version = await FlutterACPSignal.extensionVersion;
See CONTRIBUTING
See LICENSE