firebase - 发送自定义数据推送通知
问题描述
我在推送通知文档中看到了用于显示图标和自定义声音等的多种类型的数据。一个例子就像
{
"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控制台发送它吗?我正在为 ionic 3 使用 phonegap-plugin push
解决方案
图片
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'
});
推荐阅读
- batch-file - 批处理文件以读取共享中的文件夹并将每个文件夹名称附加到路径的末尾
- javascript - Webpack:如何将 html 文件复制到构建文件夹中?
- arrays - 如何在 cython 中创建和返回扩展数组?
- html - 如何使我的导航菜单显示在现有文本上
- git - zsh 显示 git-status 甚至很难它不是一个 repo
- microsoft-teams - 应用程序在 Teams 内运行,但不在本地主机上
- reactjs - 这个 React 代码中的“ref”做了什么
- html - 浏览器对@media 查询的解释存在错误
- scala - 为什么将具有 3 字段元组的普通 RDD 转换为 map 方法中的键值对是有效的?
- apache-spark - 提高窗口功能性能