2

I have a scenario when it is required to update push notification message which was previously sent without user interaction (completely based on pushes)

  1. send push message A - client receives "Hello A"
  2. send push message B to update text in A - client got "Hello A" updated to "Hello A Updated"

If it not possible then could I clear previous push notification and send new one. I need to implement it for iOS and Android platforms.

Please advise.

Mando
  • 11,414
  • 17
  • 86
  • 167

2 Answers2

1

On iOS you could use "silent push notifications". This type of notification will wake your application up if it's suspended (not terminated) and will allow it to run a process in the background. This process could be to iterate over notifications that are presented to the user and "replace" them with local notifications generated client side.

Hope this gives you a direction.

Stavash
  • 14,244
  • 5
  • 52
  • 80
  • will I be able to get the notification instance to update? or it is required to remove all existing notification and add new one? Does android have something similar? – Mando Nov 09 '14 at 09:26
  • I don't know about Android but you should be able to clear all of them and create a new one. See this: http://stackoverflow.com/questions/8682051/ios-application-how-to-clear-notifications – Stavash Nov 09 '14 at 09:54
  • I know how to clear all but it is not the behavior I want to have. In case if there are some other pushes for the same app I want to keep them. I need to replace only specific one (by id available at the initial push payload) – Mando Nov 09 '14 at 10:04
  • 1
    In that case I'm not sure you can selectively access the specific push notifications and alter them – Stavash Nov 09 '14 at 10:29
0

For Android, you can use GCM advanced feature called collapse key. Read on here: http://developer.android.com/google/gcm/adv.html

fgorski
  • 221
  • 1
  • 2
  • interesting topic, and as I understand I can collapse messages which were not delivered to client (stored at GCM servers). Once it is delivered collapse_key will not help me to override it, right? – Mando Nov 27 '14 at 00:55
  • Indeed ```collapse_key``` is only useful when the device is offline. But when you receive a notification on the device, you can decide whether to overwrite any previous notification in the notification area by specifying an ID. So if you always use the same ID, you'll only see up to one notification. If you always use a different ID (eg general a big enough random number), all notifications will pile up. If you give each notification a type, then you can use that type as ID, and you'll have only up to one notification per type. – user276648 Jul 29 '15 at 02:10