I've got a Progressive Web App which made with Blazor WebAssembly and I was wondering if I can send push notifications to iOS devices? Although people said if works now on Safari on MacOS, Push API's website says that it does not support Safari on iOS.
Do I need to wrap every web app if I target iOS? I don't have a MacBook, do I need to buy one just to achieve this?
Also there are Firebase and Azure Notification Hub, Can't I just use their service to send notifications for iOS? Firebase's had only Objective-C and Swift examples.
This also led to another question: Are notifications' way of transport is platform depended? I'm confused with cloud services' role on this.
Push Notifications in native apps also differ from a PWA. Within the app, they are often notifications of updates, news, marketing, or transactional notifications. You will only receive these notifications when you have installed the app and turned the notifications on or gave permission for it.
On both Android and iOS, users can't install PWAs from many in-app browsers, such as Facebook Mobile Browser, Instagram, Google Search App, or Gmail. In the following video the user installs a PWA from the browser on a mobile device using the browser dialog, and also using the Add to Home screen menu.
When important, time-sensitive events occur, inform your website users with push notifications you send from your server. In Safari 16 in macOS 13 or later, Safari supports web push — push notifications that use the cross-browser Push API, Notifications API, and Service Worker standards.
Go to Settings and tap Notifications. Select an app under Notification Style. Under Alerts, choose the alert style that you want. If you turn on Allow Notifications, choose when you want the notifications delivered — immediately or in the scheduled notification summary.
'Web push' is the name for the process of pushing these notifications from a server to a client on the web, rather than a locally downloaded app. PWA push notifications fall under the category of web push.
Option 2 (Harder): Use Firebase Cloud Messaging or a package like Node-APN to send push notifications the "proper" way, signed with a P12 or P8 key from the Apple Developer Portal. This gets tricky mainly because you need the iOS device identifier, which is only exposed to applications installed natively.
A push notification is simply just a message that pops up on a user's screen or device. 'Web push' is the name for the process of pushing these notifications from a server to a client on the web, rather than a locally downloaded app. PWA push notifications fall under the category of web push.
A Push notification is a new way to instantly communicate with your users the app is currently closed. Push notifications use two APIs: Notification API allows the app to display system notifications to the user while the app is active. The Push API allows the app to display these notifications even when the app is offline.
You have only three main options to get push notifications working on iOS for a PWA. In both cases, you must register an App ID on Apple Developer portal, with permission to the appropriate service. For Option 1, your registered App ID must have permission to Apple Wallet. For options 2 and 3, you must have permission to Push Notifications. In both cases, you should record your Bundle ID and Team ID in case you need it later.
Option 1 (Easier): Use PassKit to set up a generic Apple Wallet pass, which can broker notifications that are very similar to native ones. Here's some documentation, and here's a working demo of how this can send push notifications to registered devices.
Option 2 (Harder): Use Firebase Cloud Messaging or a package like Node-APN to send push notifications the "proper" way, signed with a P12 or P8 key from the Apple Developer Portal. This gets tricky mainly because you need the iOS device identifier, which is only exposed to applications installed natively. I'm afraid I don't have an answer on how to get this device ID from within a PWA, and without it, this method doesn't work.
Option 3 (not a PWA): You can use an App ID with a provisioning profile and either a P12 or P8 key, similar to the previous option, but you wrap your application in Apache Cordova, and distribute it (either through the public app store, or using MDM software and via the private Apple Business Manager).
Those are your options. I have exhausted every possible avenue researching this, and I am confident that these will remain your only options through at least the next several months. It's possible we may see further support for Web Push or perhaps just a way to get the device ID from the web in the future, but until that time, this is it. There aren't any other ways to go about this presently.
Source: I architect and develop apps for major brands like Subway, Gartner, Morgan Stanley and PwC (among many others). My research is very recent, and includes direct communication with the head of WebKit at Apple, and also with one of the world's foremost PWA and iOS experts.
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