addNotificationExtender

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:

`
class SaleNotificationExtender: NotificationCompat.Extender {
override extend(builder: NotificationCompat.Builder): NotificationCompat.Builder {
val bundle = builder.getExtras()
val context = builder.mContext
if(bundle.containsKey("special_price")) {
builder.setContentTitle("SALE")
.setContentText(bundle.getString("alert"))
} else {
// keeping Marigold default behavior
return builder.extend(NotificationExtender(context))
}

return builder;
}
}
` *
*





Then add it to our NotificationConfig using: notificationConfig.addNotificationExtender(SaleNotificationExtender())



Note: Please don't set a PendingIntent using setContentIntent directly, as it's defined by Marigold so we can track opens properly. If you want to change the Intent to be executed when a notification is tapped use ContentIntentBuilder

Return

The same NotificationConfig.

Parameters

extender

your Notification Extender