Notification Received Listener
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")
}
}
}
Content copied to clipboard
Add your implementation using Marigold.addNotificationReceivedListener
``` ... val marigold = Marigold() marigold.startEngine(getApplicationContext(), "your sdk key") marigold.addNotificationReceivedListener(MyNotificationReceivedListener()) ... ```