Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I trigger an update of the manifest.json file in an installed progressive web app on Android? [duplicate]

If I want to make changes to my Progressive Web App, e.g. a slight change on the app name, or update the logo, is it possible to force an update on all my users' installed apps?

I tried adding "?v=2" to the manifest URL,

<link rel="manifest" href="/manifest.json?v=2" />

And also forced an update on the service worker.

However, it doesn't seem to apply the new changes on the installed app.
I tried this on Google Chrome on Android.

like image 521
Nuno Avatar asked Dec 11 '17 21:12

Nuno


People also ask

How do I update my manifest?

Testing manifest updates # Plug in the device and ensure it's connected to WiFi. Use the Android task manager to shut down the PWA, then use the App panel in Android settings to force stop the PWA. In Chrome, open about://webapks and click the "Update" button for the PWA. "Update Status" should change to "Pending".

How do I force refresh PWA?

You can launch a PWA from your home screen, do what you have to do with it, then launch another app, and go back to the PWA the next day. If you haven't closed the app or turned off your phone in the meantime, it will not reload the page — instead it will simply allow you to continue your session where you left off.

Does PWA automatically update?

Yes. If you don't cache it, then browser would do a regular http call - not proxied via service worker. You can even case that JS file and check for update on opening the app, refresh the app if there is a update.

How do I run manifest JSON?

First check if manifest. json is applied in the browser. For that open developer window by pressing shortcut F12. In Application tab, click Manifest option and see if it displays information that you have set.


1 Answers

Forcing the update explicitly is not possible as per the spec. However, there's an ongoing discussion about it.

Are you completely sure your manifest.json wasn't served from the browser's cache? Or that the browser was actually served with the new HTML that referenced the renamed manifest.json?

My understanding was that you should just change the name (based on the content's hash, for instance) and let the browser do it's job. The spec says this way the browser should always request the new version. Not sure if the update should kick in immediately or before the next visit. However, I could be wrong.

like image 128
pate Avatar answered Sep 30 '22 02:09

pate