-
-
Notifications
You must be signed in to change notification settings - Fork 111
Auto update
It allows developers to use capacitor-updater with auto-update mode link to Capgo channel or equivalent.
npm install capacitor-updater
npx cap sync
The recommended usage is to use our current free update server,
you can register there
The server is super simple but allow you to manage channel and version.
💡 Documentation for self-host server will come, current focus is on Cloud solutionFollow the documentation to upload your first version to the server here:
Get in the app, Capgo your link.
After install capacitor-updater to your project, add this to your config:
// capacitor.config.json
{
"appId": "**.***.**",
"appName": "Name",
"plugins": {
"CapacitorUpdater": {
"autoUpdate": true
}
}
}
autoUpdate
will use data from your app to self identify into the Capgo server
When auto-update is setup you have to send signal from JS that your app is alive
This can be done by calling within your app notifyAppReady
.
Do it as soon as possible.
CapacitorUpdater.notifyAppReady()
- When User open app, it calls server to check for update, if found it download in background.
- When user leave the app, new version is set as active
- When user open again, he sees new app
- If
notifyAppReady()
is call, when user leave, past version is delete. - If not call, when user leave, version is reset to past one and marked as invalid.
- If
- User Continue normal flow until next update process
When you develop, be sure to remove autoUpdate
from your config or set it to false. Otherwise, you will not see your change after app grounding.
If you forget to do so, remove it and remove the app before building. Otherwise, you will stay stuck on the downloaded code.
To upload version at each commit setup CI/CD with this guide
Automatic build and release with GitHub actions
To have more control over auto-update system, I added 1 settings to allow you:
-
resetWhenUpdate
: When store update happen, force reset to native version
You have also other config available only on the [webapp()
To configure the plugin, use these settings:
// capacitor.config.json
{
"appId": "**.***.**",
"appName": "Name",
"plugins": {
"CapacitorUpdater": {
"autoUpdateUrl": "https://capgo.app/api/latest?appid=**.****.***&channel=dev",
"resetWhenUpdate": true
}
}
}
When disableAutoUpdateBreaking
is true, you can listen to event to know when app refuse to do major braking update.
import { CapacitorUpdater } from 'capacitor-updater';
CapacitorUpdater.addListener('majorAvailable', (info: any) => {
console.log('majorAvailable was fired', info.version);
});