NotificationSilencer

fun interface NotificationSilencer

Implement NotificationSilencer if you want to suppress any received notification to be presented by Marigold





Note: Direct to URI notifications using the _u parameter will never call isSilent





You could use this to silence notifications from other providers or Receive a notification to start a special background service





Example of usage to silent notifications when the custom key silent is present.





Create your implementation:

class MyNotificationSilencer: NotificationSilencer {
override isSilent(context: Context?, bundle: Bundle): Boolean {
return bundle.containsKey("silent")
}
}

Add your implementation using NotificationConfig.setSilencer

...
val marigold = Marigold()
marigold.startEngine(getApplicationContext(), "your sdk key")
notificationConfig = NotificationConfig()
notificationConfig.setSilencer(MyNotificationSilencer())
marigold.setNotificationConfig(notificationConfig)
...

Functions

Link copied to clipboard
abstract fun isSilent(context: Context, bundle: Bundle): Boolean

Return true to silence a Notification. Silent notifications will not be presented to the user.