I have been working on a PWA and need to implement the aspect of users enguagement. I have worked on push notifications but love something more user friendly. I came across the following link while searching: https://stackoverflow.com/questions/46549206/add-badge-notification-for-progressive-web-application-pwa
It is exactly the best option for me.
I have tried the following code to see how it works:
if (navigator.setAppBadge) {
const badgeCount=1;
navigator.setAppBadge(badgeCount).catch(error => {
console.log('There is a problem setting the app badge');
});
}
The code indeed set the badge on the task bar when the PWA is opened but does not set the badge on the icon of the app(which is what I actually want). On my mobile, it does not show at all.
I have searched and search for a way out and is taking me almost like forever to fine a head way.
Any help will be much appreciated.