Search code examples
androidmanifestprogressive-web-apps

Force refresh of manifest.json to download new PWA


I have a start_url set to /mysite. Now I've updated the manifest to have start_url set to /mysite?tracking=ga in order to view installs from the app.

Anyway for the life of me I can't figure out how to force a download of the new app, the app is still pointing to the old start_url. I know how to update a service worker and thus Cache API or any other caches but do not have a reliable method to force a refresh of manifest.json and thus force a new download of the apk. Even when I delete the apk and download a new app through "Add to Homescreen" it points to the old `start_url. My understanding is that every manifest requires a new apk.

*Update: Did multiple tests where I updated the manifest theme_color and the only way to see the changes is to uninstall the app and clear Chrome cache and data completely, then reinstall through "Add to home screen" prompt.


Solution

  • Refer this link.

    To quote the link,

    Updates on desktop Chrome

    When the PWA is launched, or opened in a browser tab, Chrome determines the last time the local manifest was checked for changes. If the manifest hasn't been checked since the browser last started, or it hasn't been checked in the last 24 hours, Chrome will make 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 have been closed, installs it. Once installed, all fields from the new manifest (except name, short_name, start_url and icons) are updated.

    Which properties will trigger an update?

    • display
    • scope
    • shortcuts
    • theme_color
    • file_handlers

    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.

    Which properties will trigger an update?

    • background_color
    • display
    • orientation
    • scope
    • shortcuts
    • start_url
    • theme_color
    • web_share_target

    In most cases, changes should be reflected within a day or two of the PWA being launched, after the manifest has been updated.