I am working on a chat app in Android using c2dm (gcm). Every received message raises a notification if my app is not able to show it directly. The problem is when the user is off the grid, in which case c2dm messages stack up and get delivered all at once when he is back online. A cacaphony of notification sounds is the result from adding all the notifications in a 1 second period. How to prevent this? Desired behaviour is a that the notification sound is played once, while the tickertext and notification content are up to date with the last received message
I ended up using an alarm wich was set 1 second into the future. I set multiple alarms with the same intent, the earlier ones are automatically deleted. So when a second one comes in in the 1 second interval it deletes the first.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With