Edit in GitHubLog an issue

The following example shows retrieving custom metadata using the Message.getMetadata() API. The example uses the canShow method of the PresentationDelegate, however you may retrieve the custom metadata anywhere within the delegate where the Message object is available.

Kotlin

Copied to your clipboard
var currentMessagePresentable: Presentable<InAppMessage>? = null
override fun canShow(presentable: Presentable<*>): Boolean {
if (presentable.getPresentation() !is InAppMessage) {
return
}
currentMessagePresentable = presentable as Presentable<InAppMessage>
// Get the Message object
val message = MessagingUtils.getMessageForPresentable(currentMessagePresentable)
// Retrieve the custom metadata as type Map<String, Any>
val metadata = message?.metadata
}

Java

Copied to your clipboard
Presentable<InAppMessage> currentMessagePresentable = null;
@Override
public void canShow(Presentable<?> presentable) {
if (!(presentable.getPresentation() instanceof InAppMessage)) {
return;
}
currentMessagePresentable = (Presentable<InAppMessage>) presentable;
// Get the Message object
Message message = MessagingUtils.getMessageForPresentable(currentMessagePresentable);
// Retrieve the custom metadata
if (message != null) {
Map<String, Object> metadata = message.getMetadata();
}
}

The following example shows retrieving custom metadata using the Message.metadata API. The example uses the shouldShowMessage method of the MessagingDelegate, however you may retrieve the custom metadata anywhere within the delegate where the Message object is available.

Swift

Copied to your clipboard
func shouldShowMessage(message: Showable) -> Bool {
let fullscreenMessage = message as? FullscreenMessage
let message = fullscreenMessage?.parent
// Retrieve the custom metadata
let metadata = message?.metadata
return true
}
  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2025 Adobe. All rights reserved.