【问题标题】:Send custom data to push notification发送自定义数据推送通知
【发布时间】:2019-11-19 19:59:47
【问题描述】:

我在推送通知文档中看到了用于显示图标和自定义声音等的多种类型的数据。其中一个例子是

{
    "aps" : {
        "alert" : "It's a notification with custom payload!",
        "badge" : 1,
        "content-available" : 0         
    },
    "data" :{
        "title" : "Game Request",
        "body" : "Bob wants to play poker",
        "action-loc-key" : "PLAY"
    },
}

但是我该如何发送这些数据呢?我可以通过firebase控制台发送它吗?我正在使用 phonegap-plugin push for ionic 3

【问题讨论】:

    标签: firebase push-notification ionic3


    【解决方案1】:

    图片

    cordova.plugins.notification.local.schedule({
    title: 'The big survey',
    text: 'Are you a fan of RB Leipzig?',
    attachments: ['file://img/rb-leipzig.jpg'],\\image binding
    actions: [
        { id: 'yes', title: 'Yes' },
        { id: 'no',  title: 'No' }
    ]
    

    });

    小图标 && 大图标

    cordova.plugins.notification.local.schedule({
    title: 'The Big Meeting',
    text: '4:15 - 5:15 PM\nBig Conference Room',
    smallIcon: 'res://calendar',
    icon: 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTzfXKe6Yfjr6rCtR6cMPJB8CqMAYWECDtDqH-eMnerHHuXv9egrw'
    

    });

    click here for official page

    【讨论】:

      猜你喜欢
      • 2011-12-29
      • 1970-01-01
      • 2017-08-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-06-14
      相关资源
      最近更新 更多