Returns the version of the client-side Consent extension.
{% tabs %} {% tab title="Android" %}
public static String extensionVersion();Consent.extensionVersion();{% endtab %}
{% tab title="iOS — Swift" %}
public static let extensionVersionConsent.extensionVersionpublic static let extensionVersion[AEPMobileEdgeConsent extensionVersion];
{% endtab %} {% endtabs %}
Retrieves the current consent preferences stored in the Consent extension.
{% tabs %} {% tab title="Android" %}
public static void getConsents(final AdobeCallback<Map<String, Object>> callback);- callback - callback invoked with the current consents of the extension. If an
AdobeCallbackWithErroris provided, anAdobeError, can be retruned in the eventuality of any error that occured while getting the user consents. The callback may be invoked on a different thread.
Consent.getConsents(new AdobeCallback<Map<String, Object>>() {
@Override
public void call(Map<String, Object> currentConsents) {
// handle currentConsents
}
});{% endtab %}
{% tab title="iOS — Swift" %}
static func getConsents(completion: @escaping ([String: Any]?, Error?) -> Void)- completion - Invoked with the current consent preferences or an
AEPErrorif an unexpected error occurs or the request timed out. It may be invoked on a different thread.
Consent.getConsents { currentConsents, error in
// handle currentConsents
}static func getConsents(completion: @escaping ([String: Any]?, Error?) -> Void)
[AEPMobileEdgeConsent getConsents:^(NSDictionary *currentConsents, NSError *error){
// handle currentConsents
}];
{% endtab %} {% endtabs %}
Registers the Edge Consent extension with the Mobile Core SDK.
{% tabs %} {% tab title="Android" %}
public static void registerExtension();Consent.registerExtension();{% endtab %}
{% tab title="iOS — Swift" %}
Use the MobileCore API to register the Edge Consent extension.
public static func registerExtensions(_ extensions: [NSObject.Type], _ completion: (() -> Void)? = nil)MobileCore.registerExtensions([Consent.self, ...], {
// processing after registration
})Use the AEPMobileCore API to register the Edge Consent extension.
public static func registerExtensions(_ extensions: [NSObject.Type], _ completion: (() -> Void)? = nil)[AEPMobileCore registerExtensions:@[AEPMobileEdgeConsent.class, ...] completion:^{
// processing after registration
}];
{% endtab %} {% endtabs %}
Merges the existing consents with the given consents. Duplicate keys will take the value of those passed in the API.
Note: After a user has selected collect consent no (n), the SDK will not allow you to set the users collect consent to yes (y).
{% tabs %} {% tab title="Android" %}
public static void update(final Map<String, Object> consents);- consents - A
Mapof consents defined based on Privacy/Personalization/Marketing Preferences (Consents) XDM Schema.
// 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);{% endtab %}
{% tab title="iOS — Swift" %}
static func update(with consents: [String: Any])- consents - A
[String: Any]of consents defined based on Privacy/Personalization/Marketing Preferences (Consents) XDM Schema.
// 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)static func update(with consents: [String: Any])
// 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": collectConse}];
{% endtab %} {% endtabs %}