Skip to content
This repository has been archived by the owner on Aug 28, 2023. It is now read-only.
/ flutter_acpcore Public archive

Flutter Plugin for AEP Core (Core, Identity, Lifecycle, Signal)

License

Notifications You must be signed in to change notification settings

adobe/flutter_acpcore

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

flutter_acpcore

Notice of deprecation

Since April 25, 2023, Apple has required apps submitted to the App Store to be built with Xcode 14.1 or later. The Experience Platform Mobile SDKs and extensions outlined below were built with prior versions of Xcode and are no longer compatible with iOS and iPadOS given Apple’s current App Store requirements. Consequently, on August 31, 2023, Adobe will be deprecating support for the following Experience Platform Mobile SDKs and wrapper extensions:

After August 31, 2023, applications already submitted to the App Store that contain these SDKs and wrapper extensions will continue to operate, however, Adobe will not be providing security updates or bug fixes, and these SDKs and wrapper extensions will be provided as-is exclusive of any warranty, due to the App Store policy outlined above.

We encourage all customers to migrate to the latest Adobe Experience Platform versions of the Mobile SDK to ensure continued compatibility and support. Documentation for the latest versions of the Adobe Experience Platform Mobile SDKs can be found here. The iOS migration guide can be found here.


pub package Build License

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.

Contents

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.

After you have installed Core, you can install additional AEP Flutter extensions.

Extension Package
Analytics pub package
Assurance pub package

Tests

Run:

flutter test

Usage

Initializing:

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.

iOS:

Add the initialization code in AppDelegate.m or AppDelegate.swift file of the generated iOS project.

Android:

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.

iOS:

Swift:

ACPCore.setWrapperType(.flutter)

Objective-C:

[ACPCore setWrapperType:ACPMobileWrapperTypeFlutter];
Android:
MobileCore.setWrapperType(WrapperType.FLUTTER);
Importing Core:
import 'package:flutter_acpcore/flutter_acpcore.dart';
Getting Core version:
String version = await FlutterACPCore.extensionVersion;
Updating the SDK configuration:
FlutterACPCore.updateConfiguration({"key" : "value"});
Controlling the log level of the SDK:
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);
Getting the current privacy status:
import 'package:flutter_acpcore/src/acpmobile_privacy_status.dart';

ACPPrivacyStatus result;

try {
  result = await FlutterACPCore.privacyStatus;
} on PlatformException {
  log("Failed to get privacy status");
}
Setting the 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);
Getting the SDK identities:
String result = "";

try {
  result = await FlutterACPCore.sdkIdentities;
} on PlatformException {
  log("Failed to get sdk identities");
}
Dispatching an Event Hub event:
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}''");
}
Dispatching an Event Hub event with callback:
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}''");
}
Dispatching an Event Hub response event:
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}''");
}
Importing Identity:
import 'package:flutter_acpcore/flutter_acpidentity.dart';
Getting Identity version:
String version = await FlutterACPIdentity.extensionVersion;
Sync Identifier:
import 'package:flutter_acpcore/src/acpmobile_visitor_id.dart';

FlutterACPIdentity.syncIdentifier("identifierType", "identifier", ACPMobileVisitorAuthenticationState.AUTHENTICATED);
Sync Identifiers:
FlutterACPIdentity.syncIdentifiers({"idType1":"idValue1",
                                    "idType2":"idValue2",
                                    "idType3":"idValue3"});
Sync Identifiers with Authentication State:
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}
Append visitor data to a URL:
String result = "";

try {
  result = await FlutterACPIdentity.appendToUrl("www.myUrl.com");
} on PlatformException {
  log("Failed to append URL");
}
Setting the advertising identifier:
FlutterACPCore.setAdvertisingIdentifier("ad-id");
Get visitor data as URL query parameter string:
String result = "";

try {
  result = await FlutterACPIdentity.urlVariables;
} on PlatformException {
  log("Failed to get url variables");
}
Get Identifiers:
List<ACPMobileVisitorId> result;

try {
  result = await FlutterACPIdentity.identifiers;
} on PlatformException {
  log("Failed to get identifiers");
}
Get Experience Cloud IDs:
String result = "";

try {
  result = await FlutterACPIdentity.experienceCloudId;
} on PlatformException {
  log("Failed to get experienceCloudId");
}
ACPMobileVisitorId Class:
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]https://developer.adobe.com/client-sdks/previous-versions/documentation/mobile-core/lifecycle/).

Importing Signal:
import 'package:flutter_acpcore/flutter_acpsignal.dart';
Getting Signal version:
String version = await FlutterACPSignal.extensionVersion;

Contributing

See CONTRIBUTING

License

See LICENSE