Interface NotificationReceivedListener

  • All Implemented Interfaces:

    
    public interface NotificationReceivedListener
    
                        

    Listener used to identify when a notification was received <br></br><br></br>

    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

    <pre> ``` ... val marigold = Marigold() marigold.startEngine(getApplicationContext(), "your sdk key") marigold.addNotificationReceivedListener(MyNotificationReceivedListener()) ... ```
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      abstract Unit onNotificationReceived(Context context, Bundle bundle) Called when the notification is receivedNote: You should not try to load/save data to Marigold directly from this method
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • onNotificationReceived

         abstract Unit onNotificationReceived(Context context, Bundle bundle)

        Called when the notification is received

        Note: You should not try to load/save data to Marigold directly from this method

        Parameters:
        bundle - notification data