Closed jfmcquade closed 10 months ago
Yeah definitely seems to be an issue with using notification on chrome for android - which is weird because it actually works fine in my duckduckgo browser (just not chrome)
I think ideally we need to allow the localnotification service to not crash other services if not supported
Opened #2128 to try address
Describe the bug When accessing the web preview of the app on mobile, the page hangs for about a minute before the content is rendered. This was first observed for
plh-facilitator-my
deployment, but seems to be an issue for all web previews. See screenshots section for more detailsApp version 0.16.21
To Reproduce On a mobile browser, navigate to plh-facilitator-my.web.app (or another web preview). On my device (Pixel 8), the page is blank for around a minute before the app loads.
Screenshots and videos The following screenshots are of Chrome devtools connected to my phone in USB debugging mode. They show the console logs of the startup services intialising. In each case, there is a pause of around 60 seconds after the
TemplateAsset
service finishes initialising before theLocalNotifications
service logs that its initialisation has failed (along with theLocalNotificationInteraction
service andCampaigns
service). The screen just shows the background colour of the app with no content until this point, at which the expected app content renders.plh-facilitator-my.web.app
The Performance tab doesn't seem helpful – it only lets me record for 45 seconds, which isn't long enough to capture the eventual page load
plh-tz
idems-debug.web.app
Additional context It appears the issue is with the local notifications service itself, and specifically its initialisation.
One possible culprit is the
requestPermission()
method. The fact that this bug is only present in the specific case of visiting the web preview on mobile suggests that it's likely related to some native mobile features, for example, the issue could be with the check we run withinrequestPermission()
to see if the platform is native, or else with Capacitor's ownLocalNotifications.requestPermissions()
, also within this method. I note in the docs for Capacitor's LocalNotifications plugin, there is mention of changes between Android 12 and 13 with regards toLocalNotifications.requestPermissions()
, so possibly this issue was introduced by the migration to Capacitor 5 and support for Android 13, #2046.As the local notifications service
init()
method involves some database activity, and as this issue affects all web previews on mobile and has only just been observed, it is possible that the issue is related to the recent changes to the database(s) and APIs introduced with #2115. However I'm not sure at this stage (does the db service even connect to the remote databases?).