My requirement is how to detect the device level notification on/off in android device using javascript (don't use any kind of plug-in only you can use plug-in if this plugin support to PWA application).
As per if notification off I need to show the pop up to user please enable the notification feature you'll get notifications.
Below answer is only for detective browser level notification. If anybody know Please give me exact answer how to do it. Because,I stopped there.
Please check the image here user enable once if user disable then I'm unable to send notification.
The possibilities of PWA's are huge, and using DEITY Falcon Platform, you can easily integrate Web Push Notifications directly into your PWA front-end.
The feature seems to be well documented, have you tried:
function notifyMe() {
// Let's check if the browser supports notifications
if (!("Notification" in window)) {
console.log("This browser does not support desktop notification");
}
// Let's check whether notification permissions have alredy been granted
else if (Notification.permission === "granted") {
// If it's okay let's create a notification
var notification = new Notification("Hi there!");
}
// Otherwise, we need to ask the user for permission
else if (Notification.permission !== 'denied' || Notification.permission === "default") {
Notification.requestPermission(function (permission) {
// If the user accepts, let's create a notification
if (permission === "granted") {
var notification = new Notification("Hi there!");
}
});
}
// At last, if the user has denied notifications, and you
// want to be respectful there is no need to bother them any more.
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With