0

I would like to add statistics that my Notification's Action was clicked.

I'm using standard NotificationCompat.Action.

Can I somehow set click listener to the Notification's Action?

I could pass in PendingIntent the flag and later in my Activity log statistics dependently on the flag, but it's so over engineered.

jakub
  • 3,576
  • 3
  • 29
  • 55
  • You can add onClickListener to notification's action. – Umair Jul 31 '18 at 14:16
  • There is no `setOnClickListener` for `NotificationCompat.Action` – jakub Jul 31 '18 at 14:23
  • yes there isn't but you can set onClick tasks in onReceive() method of the notification. – Umair Jul 31 '18 at 14:24
  • I won't be able to differentiate between actions there. Could you send the link to the code/documentation, what do you mean? – jakub Jul 31 '18 at 14:33
  • See this link https://stackoverflow.com/questions/13716723/open-application-after-clicking-on-notification. In this way you can add a listener to your notification and on that click you can add logs or do whatever you want to do. – Umair Jul 31 '18 at 14:57
  • Sorry @Umair, but it's unrelated. I'm asking about clicking actions in Notification like e.g. "Like" action in Facebook Messanger notification – jakub Jul 31 '18 at 15:23

0 Answers0