Configure Button and Carousel Actions

Marketers can configure the action when an end user taps a button or a carousel image in a push notification. The actions for Web URL and App URL require that you implement UrlHandler as a new SDK initialization method.

This example shows how to configure the SDK to handle button and carousel clicks in push messages.

1SFMCSdk.configure(applicationContext as Application, SFMCSdkModuleConfig.build {
2  pushFeatureModuleConfig = PushFeatureConfig.builder().apply {
3    // Other configuration values
4    setUrlHandler(UrlHandler { context, url, _ ->
5      PendingIntent.getActivity(
6        context,
7        Random().nextInt(),
8        Intent(Intent.ACTION_VIEW, url.toUri()),
9        PendingIntent.FLAG_UPDATE_CURRENT
10      )
11    })
12  }.build()
13}) {
14  // Handle initialization status
15}