Java
You can set the collect consent to one of the following values:
y
n
To understand the expected behavior, see the Update and get collect consent preferences table above.
You can set the collect consent to one of the following values:
Swift
y
n
Objective-C
You can set the collect consent to one of the following values:
y
n
To understand the expected behavior, see the Update and get collect consent preferences table above.
Java
Syntax
Copied to your clipboardpublic static void getConsents(final AdobeCallback<Map<String, Object>> callback);
- callback - callback invoked with the current consents of the extension. If an
AdobeCallbackWithError
is provided, anAdobeError
, can be returned in the eventuality of any error that occured while getting 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) {if (currentConsents == null) { return; }final Map<String, Object> consents = currentConsets.get("consents");final Map<String, Object> collectConsent = consents.get("collect");final String collectConsentStatus = collectConsent.get("val");// inspect collectConsentStatus}});
Swift
Syntax
Copied to your clipboardstatic func getConsents(completion: @escaping ([String: Any]?, Error?) -> Void)
Example
Copied to your clipboardConsent.getConsents { currentConsents, error inguard error == nil else { return }guard let consents = currentConsents["consents"] as? [String: Any] else { return }guard let collectConsent = consents["collect"] as? [String: Any] else { return }let collectConsentStatus = collectConsent["val"] as? String// inspect collectConsentStatus}
Objective-C
Syntax
Copied to your clipboardstatic func getConsents(completion: @escaping ([String: Any]?, Error?) -> Void)
Example
Copied to your clipboard[AEPMobileEdgeConsent getConsents:^(NSDictionary *currentConsents, NSError *error) {if (error) { return; }NSDictionary *consents = currentConsents[@"consents"];NSDictionary *collectConsent = currentConsents[@"collect"];NSString *collectConsentStatus = collectConsent[@"val"];// inspect collectConsentStatus}];
Java
Syntax
Copied to your clipboardpublic static void update(final Map<String, Object> consents);
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);
Swift
Syntax
Copied to your clipboardstatic func update(with consents: [String: Any])
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)
Objective-C
Syntax
Copied to your clipboardstatic func update(with consents: [String: Any])
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}];
You can set the privacy status to one of the following values:
MobilePrivacyStatus.OPT_IN
MobilePrivacyStatus.OPT_OUT
MobilePrivacyStatus.UNKNOWN
To understand the expected behavior, see the "Set and get privacy status" table above.
Java
Syntax
Copied to your clipboardpublic static void setPrivacyStatus(final MobilePrivacyStatus privacyStatus);
Example
Copied to your clipboardMobileCore.setPrivacyStatus(MobilePrivacyStatus.OPT_OUT);
You can set privacy status to one of the following values:
PrivacyStatus.optedIn
PrivacyStatus.optedOut
PrivacyStatus.unknown
To understand the expected behavior, see the Set and get privacy status table above.
Swift
Syntax
Copied to your clipboardstatic func setPrivacyStatus(_ status: PrivacyStatus)
Example
Copied to your clipboardMobileCore.setPrivacyStatus(.optedIn)
Objective-C
Syntax
Copied to your clipboard@objc(setPrivacyStatus:)static func setPrivacyStatus(_ status: PrivacyStatus)
Example
Copied to your clipboard[AEPMobileCore setPrivacyStatus:AEPPrivacyStatusOptedIn];
The enum representation of the privacy status that corresponds to the following statuses:
MobilePrivacyStatus.OPT_IN
MobilePrivacyStatus.OPT_OUT
MobilePrivacyStatus.UNKNOWN
Java
Syntax
Copied to your clipboardvoid getPrivacyStatus(AdobeCallback<MobilePrivacyStatus> callback);
- callback is invoked after the privacy status is available.
- If an instance of
AdobeCallbackWithError
is provided, and you are fetching the attributes from the Mobile SDK, the timeout value is 5000ms. If the operation times out or an unexpected error occurs, thefail
method is called with the appropriateAdobeError
.
Example
Copied to your clipboardMobileCore.getPrivacyStatus(new AdobeCallback<MobilePrivacyStatus>() {@Overridepublic void call(MobilePrivacyStatus value) {System.out.println("getPrivacyStatus: " + status);}});
The enum representation of the privacy status that corresponds to the following statuses:
PrivacyStatus.optedIn
PrivacyStatus.optedOut
PrivacyStatus.unknown
Swift
Syntax
Copied to your clipboardstatic func getPrivacyStatus(completion: @escaping (PrivacyStatus) -> Void)
- completion is invoked with the current
PrivacyStatus
.
Example
Copied to your clipboardMobileCore.getPrivacyStatus { privacyStatus inswitch privacyStatus {case .optedIn:print("Privacy Status: Opted in")case .optedOut:print("Privacy Status: Opted out")case .unknown:print("Privacy Status: Unknown")}
Objective-C
Syntax
Copied to your clipboard@objc(getPrivacyStatus:)static func getPrivacyStatus(completion: @escaping (PrivacyStatus) -> Void)
- completion is invoked with the current
PrivacyStatus
.
Example
Copied to your clipboard[AEPMobileCore getPrivacyStatus:^(AEPPrivacyStatus status) {switch (status) {case AEPPrivacyStatusOptedIn:NSLog(@"Privacy status: Opted in");break;case AEPPrivacyStatusOptedOut:NSLog(@"Privacy status: Opted out");break;case AEPPrivacyStatusUnknown:NSLog(@"Privacy status: Unknown");break;}}];