NotificationCustomizationOptions

Package: com.salesforce.marketingcloud.notifications
SDK Version: 11.0.0

Overview 

1open class NotificationCustomizationOptions

This class manages notification customization options for the Salesforce Marketing Cloud SDK. It provides two approaches for customizing notifications:

Option 1 (Guided Approach):

  • Minimum requirement: resource ID for notification’s small icon
  • Optional: NotificationLaunchIntentProvider for custom click destinations
  • Optional: NotificationChannelIdProvider for per-message channel assignment

Option 2 (Full Control):

  • Provide a NotificationBuilder implementation
  • Full responsibility for notification setup including:
    • Creating the NotificationCompat.Builder
    • Assigning notification channels
    • Redirecting launch intents via redirectIntentForAnalytics() for analytics

The SDK handles notification display in both options.

Properties 

notificationBuilder 

1@get:Nullable
2val notificationBuilder: NotificationManager.NotificationBuilder

Gets the custom notification builder if one was provided.

Methods 

create 

Variant 1: Builder Only 

1@NonNull
2open fun create(
3    @NonNull notificationBuilder: NotificationManager.NotificationBuilder
4): NotificationCustomizationOptions

Creates options with only a NotificationBuilder.

Parameters:

  • notificationBuilder - Custom builder for complete notification control

Returns: NotificationCustomizationOptions instance


Variant 2: Small Icon Only 

1@NonNull
2open fun create(
3    @DrawableRes smallIconResId: Int
4): NotificationCustomizationOptions

Creates options with just the small icon resource ID.

Parameters:

  • smallIconResId - Drawable resource ID for the notification’s small icon

Returns: NotificationCustomizationOptions instance


Variant 3: Full Guided Approach 

1@NonNull
2open fun create(
3    @DrawableRes smallIconResId: Int,
4    @Nullable launchIntentProvider: NotificationManager.NotificationLaunchIntentProvider,
5    @Nullable channelIdProvider: NotificationManager.NotificationChannelIdProvider
6): NotificationCustomizationOptions

Creates options with icon and optional providers.

Parameters:

  • smallIconResId - Drawable resource ID for the notification’s small icon
  • launchIntentProvider - Optional provider for custom launch intents
  • channelIdProvider - Optional provider for notification channel IDs

Returns: NotificationCustomizationOptions instance


toString 

1@NonNull
2open fun toString(): String

Returns string representation of the options.

See Also 

  • NotificationManager.createDefaultNotificationChannel()

Target: androidJvm

DID THIS ARTICLE SOLVE YOUR ISSUE?
Let us know so we can improve!