cordova-plugin-updater
v6.1.17
Published
Cordova plugin for hot update cordova `www/*` files.
Downloads
3
Maintainers
Readme
cordova-plugin-updater
=============================
Cordova plugin for hot update cordova
www/*
files.
Tested on android and ios.
Concept:
- on startup copy all files from www to PERSISTENT storage. (if not copied before);
- download updater.json from update server.
- compare the version constants in downloaded updater.json and local updater.json.
- if different - download new files from server to PERSISTENT, then override local updater.json.
- redirect window.location.href to PERSISTENT/$start.html;
Attention: Current version requires internet connection on app startup;
dependency :
<dependency id="cordova-plugin-file" version=">=2.0.0" />
<dependency id="cordova-plugin-file-transfer" version=">=1.0.0" />
<dependency id="cordova-plugin-splashscreen" version=">=1.0.0" />
Installation:
Setup Cordova:
cordova plugin add cordova-plugin-updater.git --variable UPDATE_URL="$UPDATE_URL"
Replace $UPDATE_URL with your server url, where your updater.json and files for update.
Setup updater.json
Write a updater.json to describe files to download and version. Put it in $UPDATE_URL/updater.json; (example http://www.anrip.com/updater.json);
Structure
don't forget to delete comment lines, must be valid JSON
{
"version": 1, //version, to see if an update is required.
"start": "index.html", //start page of your app
"files": [ //an array of new or different files to download
"index.html", //this file will be downloaded from $UPDATE_URL/index.html
"image/fon.png" //example
]
}
Tips
If server updater.json verison != local updater.json version, the updater wipes the cache, copies all files from www folder to cache, downloads new files, and overrides updater.json.