Lesson 6 · about 20 minutes
Updates that actually arrive
Apps on a home screen hang on to old copies of themselves, so a change you put live might not show up on your phone. This lesson fixes that for good: a version number, a Check for updates button, and a friendly 'new version ready' bar.
Service worker versioning so installed apps pick up releases, a Check for updates button in Settings, and a restart bar when a new version lands in the background.
Installed apps keep their cached files until a new service worker arrives, so bump its version with every release. A Check for updates button in Settings fetches it, and a Restart bar appears when one lands in the background. iPhone pauses home-screen apps rather than closing them, so check for updates when the app comes back too.
What you'll make
- A version number you can see in Settings
- A Check for updates button that installs it
- A 'new version ready · Restart' bar
You'll need: an app installed on your home screen (lesson 2).
Why phones keep old versions
An installed web app keeps a copy of its files on the phone so it opens instantly, even with no signal. That's good, until you change something: the phone keeps showing its saved copy. It's like a map you downloaded for a trip: handy offline, but it won't show a new road until you download it again.
That copy lives in the service worker's cache. Without a new service worker, there's no install, no activate, no new cache.
A version number on every release
From now on, your agent bumps it each time it puts the app live. With the skill installed, that's part of its release checklist.
Check for updates in Settings
Tap "Release a new version" to see what happens on a phone.
A restart bar when one arrives
When a new version downloads while you're using the app, it shouldn't restart under your thumb in the middle of typing. Instead, a small bar offers a restart when you're ready.
iPhone keeps home-screen apps paused rather than closing them, so the app should also check when it's reopened.
The first time, the old way
The version on your phone right now doesn't have the button yet. Close the app fully (swipe it away), open it again, maybe twice, until Settings shows "Check for updates". From then on it looks after itself.
Tell your users: the same thing, once, after the release that adds this.
When two phones are on different versions
For a few minutes after a release, one phone may be new and another old. Small changes are fine. A brand-new feature might confuse the old version, so update both phones first.
My partner's phone shows something odd after a release
Did it work?
Tick these off. They're saved in this browser, so you can come back later.
- Settings shows my app's version
- Check for updates finds and installs a new version
- A 'new version ready' bar appears on its own
- Both phones were on the new version before I used a new feature