Marketing Cloud SDK / com.salesforce.marketingcloud.notifications / NotificationManager / getDefaultNotificationBuilder

getDefaultNotificationBuilder

@NonNull open static fun getDefaultNotificationBuilder(@NonNull context: Context, @NonNull message: NotificationMessage, @NonNull channelId: String, @DrawableRes smallIconResId: Int): Builder

This method will build out a androidx.core.app.NotificationCompat.Builder with the defaults typically used by the SDK. It will set the following:

You will need to set the androidx.core.app.NotificationCompat.Builder#setContentIntent(PendingIntent) and wrap the PendingIntent using NotificationManager#redirectIntentForAnalytics(Context, PendingIntent, NotificationMessage, boolean) to receive open analytics when the notification is clicked.

Parameters

context - Context: The context provided by the SDK.

message - NotificationMessage: The message provided by the SDK.

channelId - String: The notification channel ID. If this channel does not exist then your notification will not be displayed on devices running Android O (Oreo) or newer.

smallIconResId - Int: The resource id for the small icon to be used in the notification.

Return
Builder: A androidx.core.app.NotificationCompat.Builder.