On Thu, Jul 5, 2012 at 2:02 PM, Sergey Tolkachov
<[email protected]> wrote:
> Ok, then suggest a method how to verify that notification exists.

Supply both contentIntent and deleteIntent, and track it yourself, as
I originally described.

You can also try FLAG_NO_CREATE with the getActivity() (or whatever)
call to PendingIntent. In theory, if it returns null, there is no
existing PendingIntent to be used, and therefore the Notification that
had that PendingIntent in contentIntent is gone. Personally, I'm not
completely comfortable with this model, as I am unclear on the
behavior if your process goes away, but you are welcome to experiment
with it.

> It's not so weird scenario to be able to check that some notification
> exists.

IMHO, it is.

If you want the Notification to be gone, cancel() it.

If you want the Notification to be there, raise it again (with the
same ID), and it will replace the one that is there if it happens to
be there, or will create it anew if not.

Most situations will fit one of the above two cases. Now, I won't deny
that it would be *handy* to have an isNotificationActive() method or
some such, but it is not there. Of course, you are welcome to add such
a method in a contribution to the AOSP, if you feel sufficiently
strongly about it.

--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training in DC: http://marakana.com/training/android/

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to