1

I just built my first PWA from an existing website, using PWABUILDER and not able to figure out how to handle updates after installs. Currently only deterministic way of updating the PWA, is by uninstall & reinstalling.

As per web.dev, it's very ambiguous:

  1. Chrome Android checks every 24 hour to seek a copy of manifest
  2. if there is a change in manifest, it queues the manifest and then several conditions a) all PWA windows are closed, b) Device is plugged in, c) connected to WIFI, chrome requests for the updated manifest.
  3. if the above fails, it may increase the time between checks to 30 days!

What is the right way to keep a PWA updated?

Ref:

Updates on Chrome for Android #

When the PWA is launched, Chrome determines the last time the local manifest was checked for changes. If the manifest hasn't been checked in the last 24 hours, Chrome will schedule a network request for the manifest, then compare it against the local copy.

If select properties in the manifest have changed (see list below), Chrome queues the new manifest, and after all windows of the PWA have been closed, the device is plugged in, and connected to WiFi, Chrome requests an updated WebAPK from the server. Once updated, all fields from the new manifest are used.

If Chrome is unable to get an updated manifest from the server, it may increase the time between checks to 30 days.

aLamp
  • 59
  • 1
  • 12
  • that's updating the manifest, updating the PWA itself is not so bizarre ... every time I deploy new version of App, my app eventually updates - I say eventually, because I've set it to check for a new version on startup, and then every 15 minutes while "active" – Jaromanda X Jul 28 '22 at 08:22
  • Thanks for sharing, how did you 'set it to check for a new version on startup, and every 15 minutes while "active" ' ? Is it at the service worker level? – aLamp Jul 28 '22 at 08:41
  • I use `vite-plugin-pwa` - it's easy to set up like `useRegisterSW({ immediate: true, onRegistered(r) { setInterval(() => r.update(), 15 * 60 * 1000); } })` - to be honest, this serviceWorker stuff is not something I'm overly familiar with, so I just use helpful plugins to do my bidding :p – Jaromanda X Jul 28 '22 at 08:54
  • back to what you're talking about though ... I think the "manifest update" that is talking about is more to do with updating the "WebAPK" - and that is how things like display, scope, shortcuts, theme_color and file_handlers can be updated ... name, short_name, icons and start_url do not get updated, you have to uninstall/install to change those, unfortunately (I updated icons recently so that was unfortunate) – Jaromanda X Jul 28 '22 at 09:01
  • That's where I started, no deterministic way to update pwa is other then to uninstall and reinstall? – aLamp Jul 28 '22 at 14:45
  • again, depends on what you mean by update PWA - if you mean to update the code, then, no, you don't need to uninstall/reinstall - if you mean to change the display/scope/shortcuts/theme_color/file_handlers, then you are at the whim of how Chrome on Android does it - If you want to change name/short_name/icons/start_url then you have to uninstall/install – Jaromanda X Jul 28 '22 at 23:33
  • Even code change handling can be a challenge in "cache first' mode, there I believe we need to look at setting the cache expiry optimally. – aLamp Jul 29 '22 at 02:04
  • shouldn't be, if you use the `.update` process – Jaromanda X Jul 29 '22 at 03:28

1 Answers1

0

PWA updates on macos chrome happens moment the Web app or browser is opened.

On android, it still works, but requires at least two opens.

IOS is just about uninstall and install, as what is been observed.

Abhelp
  • 16
  • 3