PushMessageListener

open class PushMessageListener(appId: String)

This class is a callback for the push message delivery. In order to modify the behavior simply extend this class and override methods

Author

Umang Chamaria

Since

5.3

Constructors

Link copied to clipboard
constructor(appId: String)
constructor()

Functions

Link copied to clipboard
open fun customizeNotification(notification: Notification, context: Context, payload: Bundle)

Callback to customise the notification object if required. SDK uses this method to add/customise a few settings like vibration, led color etc. Make sure you call super before adding your own customisation.

Link copied to clipboard
open fun customizeNotificationBuilder(notificationBuilder: NotificationCompat.Builder, context: Context, notificationPayload: NotificationPayload)

Callback to customize the notification builder object if required. You can use this method to update the channel ID, update auto-dismiss time, and other properties of the notification builder.

Link copied to clipboard
open fun getIntentFlags(payload: Bundle): Int

Get the intent flags for the redirection intent

Link copied to clipboard
@MainThread
open fun handleCustomAction(context: Context, payload: String)

Callback triggered for custom action.

Link copied to clipboard
open fun isNotificationRequired(context: Context, payload: Bundle): Boolean

Return value of this method decides whether a notification should be shown or not. In case you are overriding this method ensure you call super(context, payload), notifications will not be shown if super is not called. Note: If the super(context, payload) returns false ensure that the method always returns false.

Link copied to clipboard
open fun onCreateNotification(context: Context, notificationPayload: NotificationPayload): NotificationCompat.Builder?

Override this method if you want to build your own notification UI notification using the provided notificationPayload.

Link copied to clipboard
@MainThread
open fun onNotificationCleared(context: Context, payload: Bundle)

Callback triggered when notification is cleared from the device's notification drawer.

Link copied to clipboard
@MainThread
open fun onNotificationClick(activity: Activity, payload: Bundle): Boolean

This method is used to redirect the user to a specific screen or URL on notification click.

Link copied to clipboard
@MainThread
open fun onNotificationReceived(context: Context, payload: Bundle)

Callback triggered whenever notification is received by the application.

Link copied to clipboard
@MainThread
open fun onPostNotificationReceived(context: Context, payload: Bundle)

Callback triggered after the notification is shown.

Link copied to clipboard
@MainThread
open fun onSelfHandledNotificationReceived(context: Context, payload: Bundle)

Callback triggered when a self-handled notification is received. This callback is invoked when the MoEngage SDK receives a self handled push notification payload. Impression will be tracked by the SDK automatically for self-handled notifications as soon as callback is sent.