AngularSwPush.notificationClicksdoesnotreceivedataobject
创始人
2024-10-29 17:00:35
0

该问题的解决方案是在发送推送通知时,需在 data" 字段中附加要发送的数据对象。在接收到推送通知后,可以使用 "notificationClicks" 事件获取数据对象并进行处理。

以下是示例代码: // 发送推送通知 const pushPayload = { notification: { title: 'New Notification!', body: 'This is a notification message!', }, data: { id: 123, message: 'This is some data attached to the notification!', } }; this.swPush.requestSubscription(...) .then(sub => { // 将推送通知发送到客户端 this.http.post('/api/push', { sub, payload: pushPayload }) .subscribe(...); });

// 接收推送通知的数据 this.swPush.notificationClicks.subscribe(click => { const data = click.notification.data; // 处理接收到的数据 console.log('Received data:', data); }); "

相关内容

热门资讯

透视绝活儿!wpk俱乐部有没有... 透视绝活儿!wpk俱乐部有没有辅助(WePoKer软件)真是有辅助工具(哔哩哔哩)1、wpk俱乐部有...
透视好友房!微乐小程序黑科技,... 透视好友房!微乐小程序黑科技,微乐智能插件激活码(透视)本来是真的辅助技巧(哔哩哔哩)暗藏猫腻,小编...
透视方针!hhpoker脚本(... 透视方针!hhpoker脚本(WePoKer脚本)真是真的是有辅助方法(哔哩哔哩)该软件可以轻松地帮...
辅助透视!微乐小程序黑科技免费... 辅助透视!微乐小程序黑科技免费,微信微乐自建房脚本免费下载(透视)其实是真的辅助app(哔哩哔哩)所...
透视法子!wepoker有没有... 透视法子!wepoker有没有辅助(HHpoker透视挂)竟然真的是有辅助工具(哔哩哔哩)1)wep...
透视模拟器!微信微乐游戏辅助脚... 透视模拟器!微信微乐游戏辅助脚本,微乐自建房辅助入口官网(透视)好像是真的辅助器(哔哩哔哩)1、下载...
透视模块!pokemomo辅助... 透视模块!pokemomo辅助工具(WePoKer机器人)一贯是真的有辅助神器(哔哩哔哩)pokem...
透视ai!微乐小程序黑科技,微... 透视ai!微乐小程序黑科技,微乐自建房插件免费软件(透视)好像是有辅助工具(哔哩哔哩)该软件可以轻松...
透视秘籍!hhpoker有没有... 透视秘籍!hhpoker有没有作必弊挂(WePoKer规律)一直是真的有辅助技巧(哔哩哔哩);1、全...
为切实保障!微信微乐游戏辅助脚... 为切实保障!微信微乐游戏辅助脚本,微乐四川麻将辅助器(透视)一贯是真的辅助攻略(哔哩哔哩);1、下载...