How can I detect if the user press Clear All button or the notification is cleared by pushing sideway or notification is clicked? I need to clear some data when the notification is processed? I found the related post here link. But it needs an extra class to set up. Is there any simpler way just to clear the data once the notification has been processed. Thanks
Asked
Active
Viewed 2,040 times
1 Answers
1
To detect a clearing of a Notification
you must send a BroadCast
with the deleteIntent
and to catch this broadcast
you need to Create a BroadCastReceive
. So you have to do the basic things which are noted in the link you shared. So I don't see any other simpler way than that. You can do one thing, that instead of creating a different java file for the BroadCastReceiver
you can declare it within your service, But it is the same thing as before.

stinepike
- 54,068
- 14
- 92
- 112
-
For the user clicks the notification, how should i detect? – Bryanyan Apr 21 '13 at 04:19
-
sorry couldnt understand your comment? can you please describe – stinepike Apr 21 '13 at 04:23
-
I have one intent already for activation of an activity. How to use the same intent to implement the clear notification? – Bryanyan Apr 21 '13 at 04:28
-
Sorry my query is to detect the clear action and to detect when the user click the notification. When the user clicks, the notification is also cleared, is it? – Bryanyan Apr 21 '13 at 04:29
-
http://stackoverflow.com/a/5817024/931982 check this to detect if your activity started from notification – stinepike Apr 21 '13 at 04:31
-
1Yeah I found another [link](http://stackoverflow.com/questions/7465849/how-to-use-notification-deleteintent) for clear action. Thanks – Bryanyan Apr 21 '13 at 05:09