NotificationReceivedListener

Listener used to identify when a notification was received



For example, if we want to log when receiving notifications with the custom field 'special_price' present, you could implement a listener:

class MyNotificationReceivedListener: NotificationReceivedListener {
private val TAG = "NotificationLogger"

override onNotificationReceived(context: Context?, bundle: Bundle) {
if(bundle.containsKey("special_price")) {
Log.i(TAG, "Sale Notification received")
}
}
}

Add your implementation using Marigold.addNotificationReceivedListener

```
...
val marigold = Marigold()
marigold.startEngine(getApplicationContext(), "your sdk key")
marigold.addNotificationReceivedListener(MyNotificationReceivedListener())
...
```

Functions

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

Called when the notification is received