Opening and Canceling Android Notifications

I am fetching data from my web service to create custom notifications.

I want to track Intent

to be aware of the opening (click) or cancel (swipe) an event in the notification to inform the server for analytics.

Is there a listener for onIntentStart

or onIntentCanceled

?

Maybe a listener for notifications notificationId

?

Edit:

I want to do this without changing the content of the UserIntent or DeleteIntent, or asking the user to add lines of code to the NotificationHandlerActivity!

+3


source to share


1 answer


You can set contentIntent and deleteIntent using setContentIntent / setDeleteIntent . To learn more visit: Build Notification .

Alternatively, you can subclass NotificationListenerService , which is a service that accepts calls from the system when new notifications are sent or removed, or their rating has been changed.



Here you can find an example of how to use it.

+4


source







All Articles