【问题标题】:How to send and see many push notifications in one android device push notifications menu?如何在一个 android 设备推送通知菜单中发送和查看多个推送通知?
【发布时间】:2017-01-24 13:34:43
【问题描述】:

我目前正在使用 node-gcm 向安卓设备发送推送通知。我目前的问题是,当我向一台设备发送许多推送通知时,最新的总是会超过旧的。所以在用户看来,他只收到了一个推送通知。我想实现类似的方式来为多个操作提供推送通知,就像你在 facebook / instagram 中所做的那样。例如,在 facebook 中,您会收到每个赞、聊天消息等的推送通知。您可以在菜单中看到它们是分开的。

我正在使用 node-gcm 发送推送通知和 我在应用程序端使用 ionic-cordova / phopegap。

这是我尝试发送的代码:

  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

【问题讨论】:

    标签: android node.js cordova push-notification node-gcm


    【解决方案1】:

    我的建议是,尝试查看这个基础设施站点,它真的很棒,并且摆脱了这些问题,而且它很容易实施。

    以下是链接:

    Pushbots link

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-08-03
      • 1970-01-01
      • 1970-01-01
      • 2017-04-18
      • 2014-11-09
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多