NotificationConfig

Configuration class for building Notifications. These setting will apply to all notifications generated by Marigold.

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard
fun addAction(category: String, @DrawableRes icon: Int, title: CharSequence, actionIntent: Intent?, flags: Int): NotificationConfig
fun addAction(categoryName: String, @DrawableRes icon: Int, title: CharSequence, actionIntent: Intent?, remoteInput: RemoteInput?, flags: Int): NotificationConfig

Adds an Action to an action category.

Link copied to clipboard

Adds an action category.

Link copied to clipboard

Add your own notification extender to customise the look of received notifications

To customise the appearance or content of a notification, implement as many NotificationCompat.Extenders as you like

Having access to the NotificationCompat.Builder means you can change pretty much whatever you like about the style and content of the notification. Check out the Android Developer docs here for more info.



Note that if any extenders are added, they will by default override Marigold’s notification extender. If you’d like us to still do our default notification extension, you can manually re-extend using NotificationExtender



For example, if you want to change the title of push notifications with the custom field special_price, you could implement the following NotificationCompat.Extender:

Link copied to clipboard
Link copied to clipboard

Supply a ContentIntentBuilder to be called when a notification is tapped

Link copied to clipboard
fun setDefaultContentIntent(contentIntent: Intent, requestCode: Int, flags: Int): NotificationConfig

Supply an Intent to send when the notification is tapped.

Link copied to clipboard

Sets the notification channel on Oreo devices or later. Inaccessible pre-Oreo The NotificationChannel should be used for notification settings (vibration, sound, LED, etc) on devices >= Oreo instead of the options in this class, as it allows users more granular control of notification settings.

Link copied to clipboard

Set the default notification options that will be used. The value should be one or more of the following fields combined with a bitwise-or: Notification.DEFAULT_SOUND, Notification.DEFAULT_VIBRATE, Notification.DEFAULT_LIGHTS. For all default values, use Notification.DEFAULT_ALL.

Link copied to clipboard

Set the large icon that is shown in the ticker and notification.

Link copied to clipboard
fun setLights(argb: Int, onMs: Int, offMs: Int): NotificationConfig

Set the argb value that you would like the LED on the device to blink, as well as the rate. The rate is specified in terms of the number of milliseconds to be on and then the number of milliseconds to be off.

Link copied to clipboard

If you want certain notifications to be silent set your implementation of NotificationSilencer

Link copied to clipboard

Set the small icon to use in the notification layouts. Different classes of devices may return different sizes. See the Android UX guidelines for more information on how to design these icons.

Link copied to clipboard

Set the sound to play. It will play on the default stream. On some platforms, a notification that is noisy is more likely to be presented as a heads-up notification.

Link copied to clipboard

Set the vibration pattern to use. On some platforms, a notification that vibrates is more likely to be presented as a heads-up notification.