-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Может обновите информация для FCM? #2
Comments
https://developers.google.com/web/fundamentals/push-notifications/display-a-notification смотрите доку и примеры, параметры добавлять нужно в эту функцию self.registration.showNotification в виде json объекта 2 аргументом. self.addEventListener('push', function(event) {
console.log('Получено push-сообщение', event);
var data = event.data.json(); // json данные, которые отправили в из php скрипта ( они могут быть любыми, главное json ).
var title = 'Ура, работает!';
var body = 'Было получено сообщение от сайта.';
var icon = '/icon-192x192.png';
var tag = 'simple-push-demo-notification-tag';
event.waitUntil(
self.registration.showNotification(title, {
body: body,
icon: icon,
tag: tag
})
);
}); |
У меня подключен fcm с дефолтными jsками, через пхп я отправляю такое:
Иконка показывается, а badge и image не работает, мне нужно отредактировать скрипт firebase-messaging-sw.js? Содержимое:
|
В частности хотелось бы узнать, как отправлять badge, image (не icon) и action кнопки для WEB Push
The text was updated successfully, but these errors were encountered: