This is NOT about push notifications. It’s about standard HTML5 browser api notifications (https://developer.mozilla.org/en-US/docs/Web/API/Notification)
Prerequisite:
- App which is a vueJS SPA app was installed on iOS home screen.
- Notification.permission === “granted” was obtained
This is in the context of a Javascript VueJS non native app.
Code used to send notifications:
const sendnotification = () => {
try {
new Notification(`Alert title`, {
body: `alert body`
});
flashMessageStore.setMessage("Notification was sent", 'info');
console.log("Notification sent");
} catch (error) {
alert("sendnotification: ", error);
}
};
No error is shown, it’s as if nothing happens: notification just don’t appear.
It works perfectly on dekstop browser. Not on Chrome mobile (haven’t tested other mobile browsers).
- I didn’t installed specifically a web service worker. Should I ?
- What could be the problem ?