NotificationManager

Package: com.salesforce.marketingcloud.notifications

SDK Version: 11.0.0

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

The SDK’s default notification channel identifier.

The SDK’s default foreground notification channel identifier.

Returns the current notification enablement status.

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


Activates SDK notifications.


Deactivates SDK notifications.


Creates the SDK’s default channel if it doesn’t exist.

Parameters:

  • context: Context - The application context

Returns: String - The channel ID

Creates the SDK’s default channel, optionally forcing recreation.

Parameters:

  • context: Context - The application context
  • forceRecreate: Boolean - If true, recreates the channel even if it exists

Returns: String - The channel ID


Creates the foreground channel if it doesn’t exist.

Parameters:

  • context: Context - The application context

Returns: String - The foreground channel ID


Dismisses the notification for the specified message.

Parameters:

  • context: Context - The application context
  • message: NotificationMessage - The notification message to cancel

Retrieves the NotificationMessage from an Intent.

Parameters:

  • intent: Intent - The intent containing the notification message

Returns: NotificationMessage? - The extracted notification message, or null if not present


Constructs a Builder with SDK default settings.

Parameters:

  • context: Context - The application context
  • message: NotificationMessage - The notification message to display
  • channelId: String - The notification channel ID
  • smallIconResId: Int - Resource ID for the small icon

Returns: NotificationCompat.Builder - A configured notification builder


Creates a PendingIntent that routes through analytics tracking.

Parameters:

  • context: Context - The application context
  • openIntent: PendingIntent - The original intent to wrap
  • message: NotificationMessage - The notification message
  • autoCancel: Boolean - Whether to auto-cancel the notification

Returns: PendingIntent - A pending intent with analytics tracking

Extended version accepting an optional Bundle parameter.

Parameters:

  • context: Context - The application context
  • openIntent: PendingIntent - The original intent to wrap
  • message: NotificationMessage - The notification message
  • autoCancel: Boolean - Whether to auto-cancel the notification
  • bundle: Bundle? - Optional bundle with additional data

Returns: PendingIntent - A pending intent with analytics tracking


Adds a display listener to receive notification display events.

Parameters:

  • listener: NotificationMessageDisplayedListener - The listener to register

Removes a display listener.

Parameters:

  • listener: NotificationMessageDisplayedListener - The listener to unregister

Sets a listener to control notification display decisions.

Parameters:

  • listener: ShouldShowNotificationListener? - The listener to set, or null to remove

Customizes notification creation via NotificationCustomizationOptions.

Supplies channel IDs via NotificationCustomizationOptions.

Provides launch intents via NotificationCustomizationOptions.

Receives notification display events.

Controls notification display logic.