Is it possible to have a Notification without any Action? I want to display download progress to user and after download completion, inform user that download is finished and user can clear the notification. I don't want to start another Activity when user clicks on Notification. Is it possible? If yes, how?
Asked
Active
Viewed 1,732 times
-2
-
have you even tried before asking this question ? – njzk2 Apr 07 '13 at 15:19
-
If you know the answer, reply. Otherwise go to the next question. – Ali Behzadian Nejad Apr 07 '13 at 15:29
-
merely trying to clarify in order to avoid suggesting something you may already have attempted. – njzk2 Apr 07 '13 at 22:36
1 Answers
4
Simply create a notification and don't attach a PendingIntent to it.

Raghav Sood
- 81,899
- 22
- 187
- 195
-
I passed `null` as this: `notification.setLatestEventInfo(context, contentTitle, contentText, null);` and I got exception: `java.lang.IllegalArgumentException: contentIntent required: pkg=com.example id=2...` Any idea? – Ali Behzadian Nejad Apr 07 '13 at 15:31
-
Try putting `new Intent()` instead of passing null for the intent. – Raghav Sood Apr 07 '13 at 15:34
-
-
@AliBehzadianNejad In that case you'll need to pass an Intent to a service or receiver from which you can run the code to cancel the notification. You can't do it from an empty intent. – Raghav Sood Apr 07 '13 at 15:44
-
Checkout my comment here http://stackoverflow.com/a/16045842/892500 – Gökhan Barış Aker Feb 18 '16 at 08:25