views:

8

answers:

1

For a given Notification ID is it possible (using standard android packages) not to set a notification if there is an existing notification from the app ?

I have a news application notifying users on breaking news headlines, one of the requirement is not to over write a breaking news if the user has not cleared it or has not clicked to view it.

Im using a SharedPreference to set a flag to figure out if Im already showing a headline plus a delete intent that'll clear it. However the deleteIntent isn't always invoked when the user clears all notification.

Thanks in advance.

Sandeep

A: 

For anyone following this later:

There's no easy way to not to overwrite a existing Notification ID using the SDK. The way to do this is:

  • use a boolean flag via SharedPreference, if this flag is set then don't write the notification
  • reset this flag when the user "Clear"s all notification. To do this setup a deleteIntent (via a Service), make sure you clear this flag in the onStartCommand() and onStart()
  • optionally reset the flag when the app is launched
Ionic Walrus