sta*_*ndy 5 service-worker firebase-cloud-messaging
我有问题。在我的 Service Worker 中收到通知时:
messaging.setBackgroundMessageHandler(function(payload) {
console.log('[firebase-messaging-sw.js] Received background message ', payload);
angularClient.postMessage(payload.data);
});
Run Code Online (Sandbox Code Playgroud)
如何防止浏览器显示以下通知:
该网站已在后台更新
我所做的是向我的服务发送一条消息,其中将显示通知。现在它显示两个通知。一个来自我的服务很好,另一个说“网站......”。
您必须在调用 onBackgroundMessage 时显示通知,并确保您从registration.showNotification('title', {body: 'message'})
原因是网络推送不支持静默消息。
| 归档时间: |
|
| 查看次数: |
4947 次 |
| 最近记录: |