Edit in GitHubLog an issue

Java

Syntax

Copied to your clipboard
public static void getPropositionsForSurfaces(@NonNull final List<Surface> surfaces, @NonNull final AdobeCallback<Map<Surface, List<Proposition>>> callback)
  • surfaces is a list of surfaces for which propositions are requested.
  • callback call method is invoked with propositions map of type Map<Surface, List<Proposition>>. If the callback is an instance of AdobeCallbackWithError, and if the operation times out or an error occurs in retrieving propositions, the fail method is invoked with the appropriate AdobeError.

Example

Kotlin

Copied to your clipboard
val surface1 = Surface("myActivity#button")
val surface2 = Surface("myActivityAttributes")
val surfaces = listOf(surface1, surface2)
Messaging.getPropositionsForSurfaces(surfaces) {
it?.let { propositionsMap ->
if (propositionsMap.isNotEmpty()) {
// get the propositions for the given surfaces
propositionsMap[surface1]?.let {
// read surface1 propositions
}
propositionsMap[surface2]?.let {
// read surface2 propositions
}
}
}
}

Java

Copied to your clipboard
final Surface surface1 = new Surface("myActivity#button");
final Surface surface2 = new Surface("myActivityAttributes");
final List<Surface> surfaces = new ArrayList<>();
surfaces.add(surface1);
surfaces.add(surface2);
Messaging.getPropositionsForSurfaces(surfaces, new AdobeCallbackWithError<Map<Surface, List<Proposition>>>() {
@Override
public void fail(final AdobeError adobeError) {
// handle error
}
@Override
public void call(Map<Surface, List<Proposition>> propositionsMap) {
if (propositionsMap != null && !propositionsMap.isEmpty()) {
// get the propositions for the given surfaces
if (propositionsMap.contains(surface1)) {
final List<Proposition> propositions1 = propositionsMap.get(surface1)
// read surface1 propositions
}
if (propositionsMap.contains(surface2)) {
final List<Proposition> proposition2 = propositionsMap.get(surface2)
// read surface2 propositions
}
}
}
});

Swift

Syntax

Copied to your clipboard
static func getPropositionsForSurfaces(_ surfacePaths: [Surface], _ completion: @escaping ([Surface: [Proposition]]?, Error?) -> Void)
  • surfaces is an array of surfaces for which propositions are requested.
  • completion is invoked with propositions dictionary of type [Surface: [Proposition]]. An Error is returned if SDK fails to retrieve the propositions.

Example

Copied to your clipboard
let surface1 = Surface(path: "myView#button")
let surface2 = Surface(path: "myViewAttributes")
Messaging.getPropositionsForSurfaces([surface1, surface2]) { propositionsDict, error in
guard error == nil else {
// handle error
return
}
guard let propositionsDict = propositionsDict else {
// bail early if no propositions
return
}
// get the propositions for the given surfaces
if let propositions1 = propositionsDict[surface1] {
// read surface1 propositions
}
if let propositions2 = propositionsDict[surface2] {
// read surface2 propositions
}
}

Objective-C

Syntax

Copied to your clipboard
+ (void) getPropositionsForSurfaces: (NSArray<AEPSurface*>* _Nonnull) surfaces
completion: (void (^ _Nonnull)(NSDictionary<AEPSurface*, NSArray<AEPProposition*>*>* _Nullable propositionsDict, NSError* _Nullable error)) completion;
  • surfaces is an array of surfaces for which propositions are requested.
  • completion is invoked with propositions dictionary of type NSDictionary<AEPSurface*, NSArray<AEPProposition*>*>. An NSError is returned if SDK fails to retrieve the propositions.

Example

Copied to your clipboard
AEPSurface* surface1 = [[AEPSurface alloc] initWithPath: @"myView#button"];
AEPSurface* surface2 = [[AEPSurface alloc] initWithPath: @"myView#button"];
[AEPMobileMessaging getPropositionsForSurfaces: @[surface1, surface2]
completion: ^(NSDictionary<AEPDecisionScope*, NSArray<AEPProposition*>*>* propositionsDict, NSError* error) {
if (error != nil) {
// handle error
return;
}
NSArray<AEPProposition*>* proposition1 = propositionsDict[surface1];
// read surface1 propositions
NSArray<AEPProposition*>* proposition2 = propositionsDict[surface2];
// read surface2 propositions
}];

Java

Syntax

Copied to your clipboard
public static void updatePropositionsForSurfaces(@NonNull final List<Surface> surfaces)
  • surfaces is a list of surfaces for which propositions need updating.

Example

Kotlin

Copied to your clipboard
val surface1 = Surface("myActivity#button")
val surface2 = Surface("myActivityAttributes")
val surfaces = listOf(surface1, surface2)
Messaging.updatePropositionsForSurfaces(surfaces)

Java

Copied to your clipboard
final Surface surface1 = new Surface("myActivity#button");
final Surface surface2 = new Surface("myActivityAttributes");
final List<Surface> surfaces = new ArrayList<>();
surfaces.add(surface1);
surfaces.add(surface2);
Messaging.updatePropositionsForSurfaces(surfaces)

Swift

Syntax

Copied to your clipboard
static func updatePropositionsForSurfaces(_ surfaces: [Surface])
  • surfaces is an array of surfaces for which propositions need updating.

Example

Copied to your clipboard
let surface1 = Surface(path: "myView#button")
let surface2 = Surface(path: "myViewAttributes")
Messaging.updatePropositionsForSurfaces([surface1, surface2])

Objective-C

Syntax

Copied to your clipboard
+ (void) updatePropositionsForSurfaces: (NSArray<AEPSurface*>* _Nonnull) surfaces;
  • surfaces is an array of surfaces for which propositions need updating.

Example

Copied to your clipboard
AEPSurface* surface1 = [[AEPSurface alloc] initWithPath: @"myView#button"];
AEPSurface* surface2 = [[AEPSurface alloc] initWithPath: @"myView#button"];
[AEPMobileMessaging updatePropositionsForSurfaces: @[surface1, surface2]];

Java

Syntax

Copied to your clipboard
public static void updatePropositionsForSurfaces(@NonNull final List<Surface> surfaces, @Nullable final AdobeCallback<Boolean> callback)
  • surfaces is a list of surfaces for which propositions need updating.
  • callback call method is invoked with true if a network response was returned and successfully processed, false otherwise

Example

Kotlin

Copied to your clipboard
val surface1 = Surface("myActivity#button")
val surface2 = Surface("myActivityAttributes")
val surfaces = listOf(surface1, surface2)
Messaging.updatePropositionsForSurfaces(surfaces) { success ->
if (success) {
// handle success scenario
} else {
// handle error scenario
}
}

Java

Copied to your clipboard
final Surface surface1 = new Surface("myActivity#button");
final Surface surface2 = new Surface("myActivityAttributes");
final List<Surface> surfaces = new ArrayList<>();
surfaces.add(surface1);
surfaces.add(surface2);
Messaging.updatePropositionsForSurfaces(surfaces, success -> {
if (success) {
// handle success scenario
} else {
// handle error scenario
}
});

Swift

Syntax

Copied to your clipboard
static func updatePropositionsForSurfaces(_ surfaces: [Surface], _ completion: ((Bool) -> Void)? = nil)
  • surfaces is an array of surfaces for which propositions need updating.
  • completion is invoked with true if a network response was returned and successfully processed, false otherwise

Example

Copied to your clipboard
let surface1 = Surface(path: "myView#button")
let surface2 = Surface(path: "myViewAttributes")
Messaging.updatePropositionsForSurfaces([surface1, surface2]) { success in
if success {
// handle success scenario
} else {
// handle error scenario
}
}

Objective-C

Syntax

Copied to your clipboard
+ (void) updatePropositionsForSurfaces: (NSArray<AEPSurface*>* _Nonnull) surfaces
completion: (void (^)(BOOL)) completion;
  • surfaces is an array of surfaces for which propositions need updating.
  • completion is invoked with true if a network response was returned and successfully processed, false otherwise

Example

Copied to your clipboard
AEPSurface* surface1 = [[AEPSurface alloc] initWithPath: @"myView#button"];
AEPSurface* surface2 = [[AEPSurface alloc] initWithPath: @"myViewAttributes"];
[AEPMobileMessaging updatePropositionsForSurfaces:@[surface1, surface2] completion:^(BOOL success) {
if (success) {
// handle success scenario
} else {
// handle error scenario
}
}];
  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2025 Adobe. All rights reserved.