My team and I are currently working on the implementation on web push notification on android (in pwa and twa context).
The purpose of this dev is to replace sms to notify our users, so we need a certain quality of service.
We implemented a classical solution where the subscription is done through our web interface (angular), the endpoint is sent to our backend and used when some event is triggered to send a notification to the device. All this process is OK. After a subcription, service-workers can be inspected and the push notification endpoint is correctly set.
The http status code returned by the endpoint call (updates.push.services.mozilla.com or fcm.googleapis.com) is 99% of the time 201 but we notice that many notifications are not received by the device. We add some listeners in our service worker to call our backend when the notification is received, clicked or cancelled.
The service works fine on our desktop environment. The notification is received as soon as the browser is launched on both firefox and chrome. It is reliable but this is not our target.
We notice different behaviours among our android testers. For chrome users, some of them receive all the notifications, some of them lose a few (about 10%), some users lose a lot (about 50%), some of them need the browser to have been launched at least once, and so on. For firefox users, the service seems to be unusable. It stops working after a couple of days, for no reason : the about:serviceworkers page shows that the endpoint associated with our application is set to null, whereas it has been correctly set just after the suscription.
However, when the notification is received, and clicked, the targetted url is launched but the application or browser stay in background
From that point, we would need several things :
- any help or information that could help us having a more consistent behaviour like android or chrome settings requirements or minimal version
- a nice way to debug
- a way to inspect the running the service workers on an android device (without launching the browser)
- more details about the global operating process on android
- a way to understand why the successful submitted notification could have not been sent to the device, beyond connectivity problem.
Thanks in advance
Regards
Koj