DID THIS ARTICLE SOLVE YOUR ISSUE?
Let us know so we can improve!
Let us know so we can improve!
Package: com.salesforce.marketingcloud
Type: fun interface
SDK Version: 11.0.0
Target: androidJvm
Module: Common v1.0.0
This interface handles URL events from push notifications or in-app messages that require processing. It allows you to define custom behavior when users interact with URLs in Marketing Cloud messages.
1fun interface UrlHandler1abstract fun handleUrl(
2 context: Context,
3 url: String,
4 urlSource: String
5): PendingIntent?Returns the PendingIntent to execute when a push notification action containing a URL needs display.
Parameters:
Context) - Android contextString) - The URL to handleString) - Source of the URL eventReturns:
PendingIntent? - Nullable PendingIntent for the notification action. Return null if you want the SDK to handle the URL using default behavior.
1object CompanionA companion object for the UrlHandler interface.
As a functional interface (fun interface), UrlHandler can be implemented using a lambda expression:
1val urlHandler = UrlHandler { context, url, urlSource ->
2 // Custom URL handling logic
3 // Return a PendingIntent or null
4 null
5}