Auto Update
Ce contenu n’est pas encore disponible dans votre langue.
This documentation will explain how to run your auto-update server.
Serve your bundle
Make sure your bundle is served over HTTPS, and the server has the right CORS headers to allow the app to download the update.
e.g. https://myserver.com/app/updates/updates.json
If you’re unfamiliar with serving a bundle, we recommend you try Capgo Cloud or see an example here:
Configuration
Add an updateUrl
to your capacitor.config.json
.
Update API
The plugin will do a POST call to your API each time the app is open, with this body:
The server API should respond, in JSON, to the capacitor-updater plugin. With this data if an update is necessary:
In Auto-update mode the server should compare the versions and return the right one, if the URL key is present, the plugin starts the download process.
If you add “message” and “error” key, the version will not be set, and the message will be displayed in logs instead.
version
key should be in semver
format.
The zip should have index.html
as a file at the root, or only one folder at the root with index.html
inside.
You can use the command of the CLI to zip your bundle: