API Reference
extensionVersion
The extensionVersion() API returns the version of the client-side Consent extension.
(Android)
Syntax
Copied to your clipboardfun extensionVersion(): String
Example
Copied to your clipboardval extensionVersion = Consent.extensionVersion()
(Android)
Syntax
Copied to your clipboardpublic static String extensionVersion();
Example
Copied to your clipboardString extensionVersion = Consent.extensionVersion();
(iOS)
Syntax
Copied to your clipboardstatic var extensionVersion: String
Example
Copied to your clipboardlet extensionVersion = Consent.extensionVersion
(iOS)
Syntax
Copied to your clipboard+ (nonnull NSString*) extensionVersion;
Example
Copied to your clipboardNSString *extensionVersion = [AEPMobileEdgeConsent extensionVersion];
Syntax
Copied to your clipboardfun extensionVersion(): String
Example
Copied to your clipboardval extensionVersion = Consent.extensionVersion()
Syntax
Copied to your clipboardpublic static String extensionVersion();
Example
Copied to your clipboardString extensionVersion = Consent.extensionVersion();
Syntax
Copied to your clipboardstatic var extensionVersion: String
Example
Copied to your clipboardlet extensionVersion = Consent.extensionVersion
Syntax
Copied to your clipboard+ (nonnull NSString*) extensionVersion;
Example
Copied to your clipboardNSString *extensionVersion = [AEPMobileEdgeConsent extensionVersion];
getConsents
Retrieves the current consent preferences stored in the Consent extension.
(Android)
Syntax
Copied to your clipboardfun getConsents(callback: AdobeCallback<Map<String, Any>>)
- callback - Invoked with the current consent preferences. If an
AdobeCallbackWithError
is provided, anAdobeError
is returned if any error occurs while retrieving the user consents. The callback may be invoked on a different thread.
Example
Copied to your clipboardConsent.getConsents { currentConsents ->// Handle currentConsents}
(Android)
Syntax
Copied to your clipboardpublic static void getConsents(final AdobeCallback<Map<String, Object>> callback);
- callback - Invoked with the current consent preferences. If an
AdobeCallbackWithError
is provided, anAdobeError
is returned if any error occurs while retrieving the user consents. The callback may be invoked on a different thread.
Example
Copied to your clipboardConsent.getConsents(new AdobeCallback<Map<String, Object>>() {@Overridepublic void call(Map<String, Object> currentConsents) {// Handle currentConsents}});
(iOS)
Syntax
Copied to your clipboardstatic func getConsents(completion: @escaping ([String: Any]?, Error?) -> Void)
- completion - Invoked with the current consent preferences or an
AEPError
if an error occurs or the request times out. The completion may be invoked on a different thread.
Example
Copied to your clipboardConsent.getConsents { currentConsents, error in// Handle currentConsents}
(iOS)
Syntax
Copied to your clipboard+ (void) getConsents:^ (NSDictionary<NSString *,id> * _Nullable, NSError * _Nullable)
- completion - Invoked with the current consent preferences or an
AEPError
if an error occurs or the request times out. The completion may be invoked on a different thread.
Example
Copied to your clipboard[AEPMobileEdgeConsent getConsents:^(NSDictionary *currentConsents, NSError *error){// Handle currentConsents}];
Syntax
Copied to your clipboardfun getConsents(callback: AdobeCallback<Map<String, Any>>)
- callback - Invoked with the current consent preferences. If an
AdobeCallbackWithError
is provided, anAdobeError
is returned if any error occurs while retrieving the user consents. The callback may be invoked on a different thread.
Example
Copied to your clipboardConsent.getConsents { currentConsents ->// Handle currentConsents}
Syntax
Copied to your clipboardpublic static void getConsents(final AdobeCallback<Map<String, Object>> callback);
- callback - Invoked with the current consent preferences. If an
AdobeCallbackWithError
is provided, anAdobeError
is returned if any error occurs while retrieving the user consents. The callback may be invoked on a different thread.
Example
Copied to your clipboardConsent.getConsents(new AdobeCallback<Map<String, Object>>() {@Overridepublic void call(Map<String, Object> currentConsents) {// Handle currentConsents}});
Syntax
Copied to your clipboardstatic func getConsents(completion: @escaping ([String: Any]?, Error?) -> Void)
- completion - Invoked with the current consent preferences or an
AEPError
if an error occurs or the request times out. The completion may be invoked on a different thread.
Example
Copied to your clipboardConsent.getConsents { currentConsents, error in// Handle currentConsents}
Syntax
Copied to your clipboard+ (void) getConsents:^ (NSDictionary<NSString *,id> * _Nullable, NSError * _Nullable)
- completion - Invoked with the current consent preferences or an
AEPError
if an error occurs or the request times out. The completion may be invoked on a different thread.
Example
Copied to your clipboard[AEPMobileEdgeConsent getConsents:^(NSDictionary *currentConsents, NSError *error){// Handle currentConsents}];
registerExtension
This API has been deprecated starting in v2.0.0 and removed in v3.0.0 of the Android mobile extension.
Use MobileCore.registerExtensions()
API instead.
Java
(Android)
Syntax
Copied to your clipboardpublic static void registerExtension();
Example
Copied to your clipboardConsent.registerExtension();
Syntax
Copied to your clipboardpublic static void registerExtension();
Example
Copied to your clipboardConsent.registerExtension();
updateConsents
Merges the existing consents with the given consents. Duplicate keys will take the value of those passed in the API.
(Android)
Syntax
Copied to your clipboardfun update(consents: Map<String, Any>)
- consents - A
Map
of consents defined based on Privacy/Personalization/Marketing Preferences (Consents) XDM Schema.
Example
Copied to your clipboard// Example 1, updating users collect consent to 'yes'val collectConsents = mutableMapOf<String, Any>()collectConsents["collect"] = mutableMapOf("val" to "y")val consents = mutableMapOf<String, Any>()consents["consents"] = collectConsentsConsent.update(consents)// Example 2, updating users collect consent to 'no'val collectConsents = mutableMapOf<String, Any>()collectConsents["collect"] = mutableMapOf("val" to "n")val consents = mutableMapOf<String, Any>()consents["consents"] = collectConsentsConsent.update(consents)
(Android)
Syntax
Copied to your clipboardpublic static void update(final Map<String, Object> consents);
- consents - A
Map
of consents defined based on Privacy/Personalization/Marketing Preferences (Consents) XDM Schema.
Example
Copied to your clipboard// Example 1, updating users collect consent to 'yes'final Map<String, Object> collectConsents = new HashMap<>();collectConsents.put("collect", new HashMap<String, String>() {{put("val", "y");}});final Map<String, Object> consents = new HashMap<>();consents.put("consents", collectConsents);Consent.update(consents);// Example 2, updating users collect consent to 'no'final Map<String, Object> collectConsents = new HashMap<>();collectConsents.put("collect", new HashMap<String, String>() {{put("val", "n");}});final Map<String, Object> consents = new HashMap<>();consents.put("consents", collectConsents);Consent.update(consents);
(iOS)
Syntax
Copied to your clipboardstatic func update(with consents: [String: Any])
- consents - A
[String: Any]
of consents defined based on Privacy/Personalization/Marketing Preferences (Consents) XDM Schema.
Example
Copied to your clipboard// Example 1, updating users collect consent to 'yes'let collectConsent = ["collect": ["val": "y"]]let currentConsents = ["consents": collectConsent]Consent.update(with: currentConsents)// Example 2, updating users collect consent to 'no'let collectConsent = ["collect": ["val": "n"]]let currentConsents = ["consents": collectConsent]Consent.update(with: currentConsents)
(iOS)
Syntax
Copied to your clipboard+ (void) updateWithConsents:(NSDictionary<NSString *,id> * _Nonnull)
- consents - A
[String: Any]
of consents defined based on Privacy/Personalization/Marketing Preferences (Consents) XDM Schema.
Example
Copied to your clipboard// Example 1, updating users collect consent to 'yes'NSDictionary *collectConsent = @{ @"collect": @{@"val": @"y"};[AEPMobileEdgeConsent updateWithConsents:@{@"consents": collectConsent}];// Example 2, updating users collect consent to 'no'NSDictionary *collectConsent = @{ @"collect": @{@"val": @"n"};[AEPMobileEdgeConsent updateWithConsents:@{@"consents": collectConsent}];
Syntax
Copied to your clipboardfun update(consents: Map<String, Any>)
- consents - A
Map
of consents defined based on Privacy/Personalization/Marketing Preferences (Consents) XDM Schema.
Example
Copied to your clipboard// Example 1, updating users collect consent to 'yes'val collectConsents = mutableMapOf<String, Any>()collectConsents["collect"] = mutableMapOf("val" to "y")val consents = mutableMapOf<String, Any>()consents["consents"] = collectConsentsConsent.update(consents)// Example 2, updating users collect consent to 'no'val collectConsents = mutableMapOf<String, Any>()collectConsents["collect"] = mutableMapOf("val" to "n")val consents = mutableMapOf<String, Any>()consents["consents"] = collectConsentsConsent.update(consents)
Syntax
Copied to your clipboardpublic static void update(final Map<String, Object> consents);
- consents - A
Map
of consents defined based on Privacy/Personalization/Marketing Preferences (Consents) XDM Schema.
Example
Copied to your clipboard// Example 1, updating users collect consent to 'yes'final Map<String, Object> collectConsents = new HashMap<>();collectConsents.put("collect", new HashMap<String, String>() {{put("val", "y");}});final Map<String, Object> consents = new HashMap<>();consents.put("consents", collectConsents);Consent.update(consents);// Example 2, updating users collect consent to 'no'final Map<String, Object> collectConsents = new HashMap<>();collectConsents.put("collect", new HashMap<String, String>() {{put("val", "n");}});final Map<String, Object> consents = new HashMap<>();consents.put("consents", collectConsents);Consent.update(consents);
Syntax
Copied to your clipboardstatic func update(with consents: [String: Any])
- consents - A
[String: Any]
of consents defined based on Privacy/Personalization/Marketing Preferences (Consents) XDM Schema.
Example
Copied to your clipboard// Example 1, updating users collect consent to 'yes'let collectConsent = ["collect": ["val": "y"]]let currentConsents = ["consents": collectConsent]Consent.update(with: currentConsents)// Example 2, updating users collect consent to 'no'let collectConsent = ["collect": ["val": "n"]]let currentConsents = ["consents": collectConsent]Consent.update(with: currentConsents)
Syntax
Copied to your clipboard+ (void) updateWithConsents:(NSDictionary<NSString *,id> * _Nonnull)
- consents - A
[String: Any]
of consents defined based on Privacy/Personalization/Marketing Preferences (Consents) XDM Schema.
Example
Copied to your clipboard// Example 1, updating users collect consent to 'yes'NSDictionary *collectConsent = @{ @"collect": @{@"val": @"y"};[AEPMobileEdgeConsent updateWithConsents:@{@"consents": collectConsent}];// Example 2, updating users collect consent to 'no'NSDictionary *collectConsent = @{ @"collect": @{@"val": @"n"};[AEPMobileEdgeConsent updateWithConsents:@{@"consents": collectConsent}];
Since Android 3.0.2 and iOS 5.0.1, Consent.update
requests ignore repeated updates that match current consent preferences when received within one second of the previous request.
When Consent.update
API is called, the Consent extension uses Adobe Standard 2.0 to communicate with the Edge Network. Additionally, the property metadata
is set to the time at which the API is called.
The following example shows when Consent.update
is called to set collect consent to y
:
Copied to your clipboard// Example in iOS (Swift), updating user's collect consent to 'yes'let collectConsent = ["collect": ["val": "y"]]let currentConsents = ["consents": collectConsent]Consent.update(with: currentConsents)
Bellow you can see the snippet of the request payload sent to the Edge Network:
Copied to your clipboard"consent": [{"standard": "Adobe","version": "2.0","value": {"metadata": {"time" : "2023-10-03T17:23:04.443Z"},"collect": {"val": "y"}}}]
For additional information about the management of consent preferences, please refer to the Privacy and GDPR documentation.