Cordova SDK
appspacer-cordova — OTA live updates for Apache Cordova apps. Push updated web bundles (HTML/JS/CSS) without an app store release.
Requirements
| Minimum | |
|---|---|
| Cordova | >= 11 |
| cordova-ios | >= 6 |
| cordova-android | >= 11 |
Installation
cordova plugin add appspacer-cordovaiOS — SSZipArchive
The plugin depends on SSZipArchive for bundle extraction. If you use a config.xml pod declaration, add:
<platform name="ios">
<framework src="SSZipArchive" type="podspec" />
</platform>Initialization
Call AppSpacer.init once deviceready fires:
document.addEventListener('deviceready', function() {
AppSpacer.init(
{
deploymentKey: 'your_deployment_key',
appVersion: '1.0.0',
},
function() { console.log('AppSpacer ready'); },
function(err) { console.error('AppSpacer init failed', err); }
);
}, false);Sync (recommended)
AppSpacer.sync(
{},
function(result) {
if (result.updateAvailable) {
console.log('Update applied:', result.releaseId);
// App will reload automatically
}
},
function(err) { console.error('Sync failed', err); }
);Manual Control
// Check
AppSpacer.checkForUpdate(
function(update) {
if (!update.updateAvailable) return;
// update.packageUrl, update.hash, update.releaseId available
console.log('Update available:', update.releaseId);
},
function(err) { console.error(err); }
);
// Reset to bundled app
AppSpacer.resetToBuiltIn(
function() { console.log('Reset done'); },
function(err) { console.error(err); }
);API Reference
| Method | Params | Description |
|---|---|---|
AppSpacer.init(config, success, error) | config object | Initialize the plugin |
AppSpacer.sync(options, success, error) | {} | Full check → download → apply |
AppSpacer.checkForUpdate(success, error) | — | Check server for updates |
AppSpacer.getDeviceId(success, error) | — | Get unique device ID |
AppSpacer.resetToBuiltIn(success, error) | — | Revert to bundled web assets |
AppSpacer.reload(success, error) | — | Reload the WebView |
Backend Integration
POST /api/sdk/cordova/check
Body: { deployment_key, app_version, package_hash, install_id }
POST /api/sdk/cordova/report-status
Body: { release_id, device_id, app_version, status, error_message }Push a zip of your www/ directory with --platform cordova.
Last updated on