UrlHandler

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.

Returns the PendingIntent to execute when a push notification action containing a URL needs display.

Parameters:

  • context (Context) - Android context
  • url (String) - The URL to handle
  • urlSource (String) - Source of the URL event

Returns:

PendingIntent? - Nullable PendingIntent for the notification action. Return null if you want the SDK to handle the URL using default behavior.

A companion object for the UrlHandler interface.

As a functional interface (fun interface), UrlHandler can be implemented using a lambda expression: