flutter_aepedgeconsent

Creator: coderz1093

Last updated:

Add to Cart

Description:

flutter aepedgeconsent

flutter_aepedgeconsent #

flutter_aepedgeconsent is a flutter plugin for the iOS and Android Adobe Experience Platform Edge Consent SDK to allow for integration with Flutter applications. Functionality to enable the Consent for Edge Network extension is provided entirely through Dart documented below.
Prerequisites #
The Consent extension has the following peer dependency, which must be installed prior to installing it:

flutter_aepcore

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
copied to clipboard
Usage #
For more detailed information on the Consent APIs, visit the documentation here
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 AEPEdgeConsent;
...
@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,
AEPMobileEdgeConsent.class
];

[AEPMobileCore registerExtensions:extensionsToRegister completion:^{
[AEPMobileCore configureWithAppId: ENVIRONMENT_FILE_ID];
}];
return YES;
}
copied to clipboard
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.consent.Consent;

...
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(Consent.EXTENSION, Identity.EXTENSION, Edge.EXTENSION),
o -> Log.d("MainApp", "Adobe Experience Platform Mobile SDK was initialized")
);
}
}
copied to clipboard

Importing the SDK: #
import 'package:flutter_aepedgeconsent/flutter_aepedgeconsent.dart';
copied to clipboard

API reference #
extensionVersion #
Returns the SDK version of the Consent extension.
Syntax
static Future<String> get extensionVersion
copied to clipboard
Example
String version = await Consent.extensionVersion;
copied to clipboard

getConsents #
Retrieves the current consent preferences stored in the Consent extension.
Syntax
static Future<Map<String, dynamic>> get consents
copied to clipboard
Example
Map<String, dynamic> result = {};
try {
result = await Consent.consents;
} on PlatformException {
log("Failed to get consent info");
}
copied to clipboard

updateConsents #
Merges the existing consents with the given consents. Duplicate keys will take the value of those passed in the API.
Syntax
static Future<void> update(Map<String, dynamic> consents)
copied to clipboard
Example
Map<String, dynamic> collectConsents = allowed
? {
"collect": {"val": "y"}
}
: {
"collect": {"val": "n"}
};
Map<String, dynamic> currentConsents = {"consents": collectConsents};

Consent.update(currentConsents);
copied to clipboard
Contributing #
See CONTRIBUTING
License #
See LICENSE

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.