NotificationCustomizationOptions
NotificationManager
NotificationMessage
ProximityNotificationCustomizer
PushNotificationActionHandler
DID THIS ARTICLE SOLVE YOUR ISSUE?
Let us know so we can improve!
Let us know so we can improve!
Package: com.salesforce.marketingcloud.notifications
SDK Version: 11.0.0
An abstract class for managing push notifications in the Salesforce Marketing Cloud Android SDK.
1constructor()1val DEFAULT_CHANNEL_ID: String = "com.salesforce.marketingcloud.DEFAULT_CHANNEL"The SDK’s default notification channel identifier.
1val DEFAULT_FOREGROUND_CHANNEL_ID: String = "com.salesforce.marketingcloud.DEFAULT_FOREGROUND_CHANNEL"The SDK’s default foreground notification channel identifier.
1abstract fun areNotificationsEnabled(): BooleanReturns the current notification enablement status.
Returns: Boolean - true if notifications are enabled, false otherwise
1abstract fun enableNotifications()Activates SDK notifications.
1abstract fun disableNotifications()Deactivates SDK notifications.
1open fun createDefaultNotificationChannel(context: Context): StringCreates the SDK’s default channel if it doesn’t exist.
Parameters:
context: Context - The application contextReturns: String - The channel ID
1open fun createDefaultNotificationChannel(context: Context, forceRecreate: Boolean): StringCreates the SDK’s default channel, optionally forcing recreation.
Parameters:
context: Context - The application contextforceRecreate: Boolean - If true, recreates the channel even if it existsReturns: String - The channel ID
1open fun createForegroundNotificationChannel(context: Context): StringCreates the foreground channel if it doesn’t exist.
Parameters:
context: Context - The application contextReturns: String - The foreground channel ID
1open fun cancelNotificationMessage(context: Context, message: NotificationMessage)Dismisses the notification for the specified message.
Parameters:
context: Context - The application contextmessage: NotificationMessage - The notification message to cancel1open fun extractMessage(intent: Intent): NotificationMessage?Retrieves the NotificationMessage from an Intent.
Parameters:
intent: Intent - The intent containing the notification messageReturns: NotificationMessage? - The extracted notification message, or null if not present
1open fun getDefaultNotificationBuilder(
2 context: Context,
3 message: NotificationMessage,
4 channelId: String,
5 smallIconResId: Int
6): NotificationCompat.BuilderConstructs a Builder with SDK default settings.
Parameters:
context: Context - The application contextmessage: NotificationMessage - The notification message to displaychannelId: String - The notification channel IDsmallIconResId: Int - Resource ID for the small iconReturns: NotificationCompat.Builder - A configured notification builder
1open fun redirectIntentForAnalytics(
2 context: Context,
3 openIntent: PendingIntent,
4 message: NotificationMessage,
5 autoCancel: Boolean
6): PendingIntentCreates a PendingIntent that routes through analytics tracking.
Parameters:
context: Context - The application contextopenIntent: PendingIntent - The original intent to wrapmessage: NotificationMessage - The notification messageautoCancel: Boolean - Whether to auto-cancel the notificationReturns: PendingIntent - A pending intent with analytics tracking
1open fun redirectIntentForAnalytics(
2 context: Context,
3 openIntent: PendingIntent,
4 message: NotificationMessage,
5 autoCancel: Boolean,
6 bundle: Bundle?
7): PendingIntentExtended version accepting an optional Bundle parameter.
Parameters:
context: Context - The application contextopenIntent: PendingIntent - The original intent to wrapmessage: NotificationMessage - The notification messageautoCancel: Boolean - Whether to auto-cancel the notificationbundle: Bundle? - Optional bundle with additional dataReturns: PendingIntent - A pending intent with analytics tracking
1abstract fun registerNotificationMessageDisplayedListener(
2 listener: NotificationMessageDisplayedListener
3)Adds a display listener to receive notification display events.
Parameters:
listener: NotificationMessageDisplayedListener - The listener to register1abstract fun unregisterNotificationMessageDisplayedListener(
2 listener: NotificationMessageDisplayedListener
3)Removes a display listener.
Parameters:
listener: NotificationMessageDisplayedListener - The listener to unregister1abstract fun setShouldShowNotificationListener(
2 listener: ShouldShowNotificationListener?
3)Sets a listener to control notification display decisions.
Parameters:
listener: ShouldShowNotificationListener? - The listener to set, or null to removeCustomizes notification creation via NotificationCustomizationOptions.
Supplies channel IDs via NotificationCustomizationOptions.
Provides launch intents via NotificationCustomizationOptions.
Receives notification display events.
Controls notification display logic.