asid
asid

Reputation: 31

How to distinguish when my notification is dismissed via Dismissed all button not swipe dismiss?

I have an app that posts notifications to system tray. Each of them has DeleteIntent set. The intent gets triggered for both swipe dismiss or dismiss all from the system tray.

Is is possible to distinguish between these two types of dismisses?

Upvotes: 3

Views: 93

Answers (1)

bidyut
bidyut

Reputation: 93

TL;DR; Not yet (API 22 being the latest release)

As of API 22 there still isn't any way to detect the differences inside of your app. One round about way of figuring this out is if you get a bunch of dismissals in short succession.

05-08 23:04:58.360  15849-15849/com.bidyut.notificationtest D/wtf﹕ action_dismiss
05-08 23:04:58.360  15849-15849/com.bidyut.notificationtest D/wtf﹕ action_dismiss
05-08 23:04:58.364  15849-15849/com.bidyut.notificationtest D/wtf﹕ action_dismiss
05-08 23:04:58.364  15849-15849/com.bidyut.notificationtest D/wtf﹕ action_dismiss
05-08 23:04:58.364  15849-15849/com.bidyut.notificationtest D/wtf﹕ action_dismiss

As you can see they are all within the same second. However, this type of detection can only be considered if your app happen to have multiple notifications up at that point of time.

Upvotes: 3

Related Questions