firebase云消息传递:setBackgroundMessageHandler不被调用 [英] firebase cloud messaging: setBackgroundMessageHandler not called
问题描述
我在Chrome 54上试了这个。
任何想法,我需要做什么来定制服务工作者的消息? b
非常感谢!
对于遇到同样问题的人来说,答案是: https://github.com/firebase/quickstart-js/issues/71
简短摘要:不要在您的json消息中包含notification元素。
I am prototyping browser push notifications with FCM. I just copied the example code from the quickstart (https://github.com/firebase/quickstart-js/tree/master/messaging). Messages are recieved and displayed as they should be. But when I try to modify the message in the Service Worker (messaging.setBackgroundMessageHandler) nothing happens. The service worker is called, and if I implement an event listener in that service worker for the push notifications, it catches the event. But the method setBackgroundMessageHandler is never called. I am trying this on Chrome 54.
Any ideas what I need to do to customize the message in the service worker?
Thank you very much!
For anyone experiencing the same problem, here is the answer: https://github.com/firebase/quickstart-js/issues/71
short summary: do not include a "notification" element in your json message.
这篇关于firebase云消息传递:setBackgroundMessageHandler不被调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!