NotificationManager

Package 

com.salesforce.marketingcloud.pushfeature.notifications

Overview 

An abstract class for managing push notifications in the Salesforce Marketing Cloud SDK.

Module: Push Feature Module v2.0.0
SDK: Salesforce Marketing Cloud Unified SDK 11.0.0
Platform: androidJvm


Constructor 

NotificationManager() 

1NotificationManager()

Default constructor with no parameters.


Methods 

areNotificationsEnabled 

1fun areNotificationsEnabled(): Boolean

Returns whether notifications are currently enabled.

Returns: Boolean - true if notifications are enabled, false otherwise


enableNotifications 

1fun enableNotifications()

Enables push notifications.


disableNotifications 

1fun disableNotifications()

Disables push notifications.


showNotificationMessage 

1fun showNotificationMessage(message: NotificationMessage)

Displays a notification message.

Parameters:

  • message: NotificationMessage - The NotificationMessage to display

setShouldShowNotificationListener 

1fun setShouldShowNotificationListener(listener: NotificationManager.ShouldShowNotificationListener?)

Sets a listener to determine if a notification should be displayed.

Parameters:

  • listener: NotificationManager.ShouldShowNotificationListener? - The ShouldShowNotificationListener instance (nullable)

registerNotificationMessageDisplayedListener 

1fun registerNotificationMessageDisplayedListener(listener: NotificationManager.NotificationMessageDisplayedListener)

Registers a listener for notification display events.

Parameters:

  • listener: NotificationManager.NotificationMessageDisplayedListener - The NotificationMessageDisplayedListener to register

unregisterNotificationMessageDisplayedListener 

1fun unregisterNotificationMessageDisplayedListener(listener: NotificationManager.NotificationMessageDisplayedListener)

Removes a previously registered listener.

Parameters:

  • listener: NotificationManager.NotificationMessageDisplayedListener - The NotificationMessageDisplayedListener to unregister

Nested Types 

Companion 

1object Companion

Static companion object.


NotificationBuilder 

1fun interface NotificationBuilder

Provides custom notification building. Used in NotificationCustomizationOptions during SDK initialization via PushFeatureConfig.notificationCustomizationOptions.


NotificationChannelIdProvider 

1fun interface NotificationChannelIdProvider

Provides notification channel IDs. Used in NotificationCustomizationOptions.


NotificationLaunchIntentProvider 

1fun interface NotificationLaunchIntentProvider

Provides intents for notification launches.


NotificationMessageDisplayedListener 

1fun interface NotificationMessageDisplayedListener

Listens for notification display events.


ShouldShowNotificationListener 

1fun interface ShouldShowNotificationListener

Queries whether a notification should be shown.