Xyztor
Xyztor

Reputation: 3

How to send and see many push notifications in one android device push notifications menu?

I am currently using node-gcm to send push notifications to android devices. My current problem is, that when I send many push notifications to one device, the newest always goes over the older ones. So it seems to the user that he only got one push notification. I want to implement similar way to have push notifications for multiple actions, as you have in facebook / instagram. For example in facebook you get push notifications for every like, chat message and so on. You can see them separated in the menu.

I am using node-gcm to send push notifications and I use ionic-cordova / phopegap on the application side.

Here is the code I have tried for sending them:

  message = new gcm.Message
  sender = new gcm.Sender '*************************************'
  registrationIds = []

  message.addData 'message', notification.message
  message.addData 'title', notification.title
  message.addData 'msgcnt','3'
  message.addData 'NOTIFICATION_ID', Date.now()
  message.addData 'ID', Date.now()
  message.addData 'id', Date.now()
  message.addData 'situation', notification.type
  message.addData 'url', notification.url

  PushId.find {userId: @_id}, (err, pushIds) ->
    for singleId in pushIds
      console.log 'Sending push to: ' + singleId.pushId
      registrationIds.push singleId.pushId

    sender.send message, registrationIds, 4, (result) ->
        console.log 'Send done:' + result

Upvotes: 0

Views: 80

Answers (1)

Lutaaya Huzaifah Idris
Lutaaya Huzaifah Idris

Reputation: 3990

My advice would be, check out this infrastructure site. It's really amazing and gets rid of those issues, and it's so easy to implement.

Pushbots link

Upvotes: 0

Related Questions