PushFeatureConfig

Package 

com.salesforce.marketingcloud.pushfeature.config

Overview 

A data class that extends PushFeatureModuleConfig to configure push notification functionality for the Salesforce Marketing Cloud SDK. It provides settings for Firebase Cloud Messaging integration, notification customization, URL handling, and notification filtering.

Class Declaration 

1data class PushFeatureConfig : PushFeatureModuleConfig

Inheritance 

  • Extends: PushFeatureModuleConfig

Properties 

senderId 

1@JvmField
2val senderId: String?

The Firebase Cloud Messaging sender ID for push notifications. This is required for FCM integration.

notificationCustomizationOptions 

1@JvmField
2val notificationCustomizationOptions: NotificationCustomizationOptions

Configuration options for customizing notification appearance and behavior, including icon, sound, LED color, and other visual elements.

urlHandler 

1@JvmField
2val urlHandler: UrlHandler?

Optional handler for processing URLs from push notifications. Implement this interface to customize URL handling behavior.

shouldShowNotificationListener 

1@JvmField
2val shouldShowNotificationListener: NotificationManager.ShouldShowNotificationListener?

Optional listener for filtering or controlling whether notifications should be displayed. Allows dynamic control of notification visibility based on custom logic.

Methods 

toBuilder() 

1fun toBuilder(): PushFeatureConfig.Builder

Creates a new Builder instance initialized with the current configuration values.

Returns: A Builder with current configuration values

Nested Types 

Builder 

1class PushFeatureConfig.Builder

Builder class for constructing PushFeatureConfig instances using a fluent API pattern.

Builder Methods 

setSenderId
1fun setSenderId(senderId: String?): Builder

Sets the Firebase Cloud Messaging sender ID.

Parameters:

  • senderId - The FCM sender ID (typically a 12-digit number)

Returns: The Builder instance for method chaining

setNotificationCustomizationOptions
1fun setNotificationCustomizationOptions(options: NotificationCustomizationOptions): Builder

Sets the notification customization options.

Parameters:

  • options - NotificationCustomizationOptions instance with customization settings

Returns: The Builder instance for method chaining

setUrlHandler
1fun setUrlHandler(handler: UrlHandler?): Builder

Sets the URL handler for processing notification URLs.

Parameters:

  • handler - UrlHandler implementation or null

Returns: The Builder instance for method chaining

setShouldShowNotificationListener
1fun setShouldShowNotificationListener(listener: NotificationManager.ShouldShowNotificationListener?): Builder

Sets the listener for controlling notification visibility.

Parameters:

  • listener - ShouldShowNotificationListener implementation or null

Returns: The Builder instance for method chaining

build
1fun build(): PushFeatureConfig

Finalizes the configuration and creates the PushFeatureConfig instance.

Returns: A new PushFeatureConfig instance with the specified configuration

Companion 

1object Companion

Companion object providing factory methods for creating Builder instances.

Companion Methods 

builder
1fun builder(): PushFeatureConfig.Builder

Creates a new Builder instance for constructing a PushFeatureConfig.

Returns: A new PushFeatureConfig.Builder instance

Usage Example 

1val pushConfig = PushFeatureConfig.builder()
2    .setSenderId("123456789012")
3    .setNotificationCustomizationOptions(
4        NotificationCustomizationOptions.create(R.drawable.ic_notification)
5    )
6    .setUrlHandler(customUrlHandler)
7    .setShouldShowNotificationListener { message ->
8        // Return true to show notification, false to suppress
9        true
10    }
11    .build()

Related Types 

  • PushFeature - The main push feature module
  • PushFeatureModuleConfig - Parent configuration class
  • NotificationCustomizationOptions - Notification customization settings
  • UrlHandler - Interface for handling URLs from notifications
  • NotificationManager.ShouldShowNotificationListener - Interface for notification filtering