Blazor Webassembly PWA notification on mobilephone

Viewed 1903

I will create a Blazor Webassembly PWA. The server should send a notification to a mobilephone and the message should displayed outside of the browser such as when you receive an email from outlook. Is that possible?

3 Answers

Yes it is possible with Browsers support. Check out HTML5 Notification API it should work on Mobile as well. There is a "simple" notification and a bit more complex where you can even create custom events (buttons with custom code to run). But it is somewhat complicated and have to use ServiceWorkes as well... One more drawback it requires user consent to show Notifications!

There is a wrapper component library for both types of HTML Notification APIs you can use this Nuget. You can even try it out with a demo app.

NOTE: this component only provides a wrapper for HTML Notification APIs to prompt messages. It is not sending/subscribing to any massaging or PUSH events. So it is not equivalent with PUSH notifications. For that you have to have iOS or Android applications and register for Push services, etc...

Toast demo

Related