flutter_aepedgebridge

pub package Build License

flutter_aepedgebridge is a flutter plugin for the iOS and Android Adobe Experience Platform Edge Bridge to allow for integration with flutter applications.

The Edge Bridge mobile extension provides seamless routing of data to the Adobe Experience Platform Edge Network for existing SDK implementations. For applications which already make use of the MobileCore.trackAction and/or MobileCore.trackState APIs to send data to Adobe Analytics, this extension will automatically route those API calls to the Edge Network, making the data available for mapping to a user's XDM schema using the Data Prep for Data Collection.

Note
For new implementations of the Adobe Experience Platform SDK, it's highly recommended to send event data that is already XDM formatted using the Edge.sendEvent API instead of converting events from the MobileCore.trackState and MobileCore.trackAction APIs using Edge Bridge.

However, in cases where it is not easy to refactor an existing application, the Edge Bridge extension exists as a drop-in solution to send converted trackState and trackAction events to the Edge Network.

Prerequisites

The Edge Bridge extension has the following peer dependencies, which must be installed prior to installing the Edge Bridge extension:

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.

Tests

Run:

flutter test

Usage

Installing and registering the extension with the AEP Mobile Core

Install the Adobe Experience Platform Edge Network extension in your mobile property and configure the default Datastream ID by following the steps in the Edge Network extension documentation.

Note
Experience Platform Edge Bridge does not have a corresponding extension card in the Data Collection UI; no changes to a Data Collection mobile property are required to use Edge Bridge.

Registering the extension with AEPCore:

Note
It is required to initialize the SDK via native code inside your AppDelegate (iOS) and MainApplication class (Android).

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.

Initialization Example

iOS

// AppDelegate.h
@import AEPCore;
@import AEPEdge;
@import AEPEdgeIdentity;
@import AEPEdgeBridge;
...
@implementation AppDelegate

// AppDelegate.m
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [AEPMobileCore setWrapperType:AEPWrapperTypeFlutter];

     // TODO: Set up the preferred Environment File ID from your mobile property configured in Data Collection UI
    NSString* ENVIRONMENT_FILE_ID = @"YOUR-APP-ID";
    
    NSArray *extensionsToRegister = @[AEPMobileEdgeIdentity.class, 
                                      AEPMobileEdge.class,                                              
                                      AEPMobileEdgeBridge.class
                                      ];

    [AEPMobileCore registerExtensions:extensionsToRegister completion:^{
      [AEPMobileCore configureWithAppId: ENVIRONMENT_FILE_ID];
    }];
    return YES;   
 } 

Android

import com.adobe.marketing.mobile.MobileCore;
import com.adobe.marketing.mobile.Edge;
import com.adobe.marketing.mobile.edge.identity.Identity;
import com.adobe.marketing.mobile.edge.bridge.EdgeBridge
  
...
import io.flutter.app.FlutterApplication;
...
public class MainApplication extends FlutterApplication {
  ...
  // TODO: Set up the preferred Environment File ID from your mobile property configured in Data Collection UI
  private final String ENVIRONMENT_FILE_ID = "YOUR-APP-ID";

  @Override
  public void on Create(){
    super.onCreate();
    ...
    MobileCore.setApplication(this);
    MobileCore.setWrapperType(WrapperType.FLUTTER);
    MobileCore.configureWithAppID(ENVIRONMENT_FILE_ID);

    MobileCore.registerExtensions(
      Arrays.asList(Identity.EXTENSION, Edge.EXTENSION, EdgeBridge.EXTENSION),
      o -> Log.d("MainApp", "Adobe Experience Platform Mobile SDK was initialized")
    );
  }
}

Importing the SDK:

import 'package:flutter_aepedgebridge/flutter_aepedgebridge.dart';

Next steps - Data Prep mapping and validation with Assurance

For Data Prep mapping examples and tips on validating with Assurance, refer to the Edge Bridge tutorials.

API reference

extensionVersion

Returns the version of the client-side Edge Bridge extension.

Syntax

static Future<String> get extensionVersion

Example

String version = await EdgeBridge.extensionVersion;