首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在一个android设备的推送通知菜单中发送和查看多个推送通知?

如何在一个android设备的推送通知菜单中发送和查看多个推送通知?
EN

Stack Overflow用户
提问于 2017-01-24 21:34:43
回答 1查看 74关注 0票数 0

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

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

下面是我尝试发送它们的代码:

代码语言:javascript
复制
  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
EN

回答 1

Stack Overflow用户

发布于 2017-01-24 21:56:21

我的建议是,试着看看这个基础设施网站,它真的很神奇,摆脱了这些问题,而且它很容易实现。

下面的是链接:

Pushbots link

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/41829608

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档