Capacitor / Ionic SDK
@appspacer/capacitor — OTA live updates for Capacitor and Ionic apps. Push updated web bundles (HTML/JS/CSS) to users without an app store release.
Update model: Downloads a zip of your updated web assets, verifies its integrity, extracts it to the device’s documents directory, and reloads the WebView from there on next launch.
Requirements
| Minimum | |
|---|---|
| Capacitor | >= 6 |
| iOS deployment target | 14.0 |
| Android minSdk | 22 |
Installation
npm install @appspacer/capacitor
npx cap synciOS — add SSZipArchive
AppSpacer uses SSZipArchive to extract update bundles. Add it via CocoaPods:
# ios/App/Podfile
pod 'SSZipArchive'Then run:
cd ios && pod install && cd ..Initialization
import { AppSpacer } from '@appspacer/capacitor';
// Call once at app startup (e.g. app.component.ts for Ionic Angular)
await AppSpacer.init({
deploymentKey: 'your_deployment_key',
appVersion: '1.0.0',
});Config Options
| Option | Type | Default | Description |
|---|---|---|---|
deploymentKey | string | Required | Deployment key from the dashboard |
appVersion | string | Required | Current native app version |
debugLogging | boolean | false | Verbose logs |
Sync (recommended)
sync() handles the full lifecycle: check → download → verify → apply.
import { AppSpacer } from '@appspacer/capacitor';
const result = await AppSpacer.sync();
if (result.updateAvailable) {
// Reload to apply the update
await AppSpacer.reload();
}Manual Control
// 1. Check
const update = await AppSpacer.checkForUpdate();
if (update.updateAvailable && update.packageUrl && update.hash && update.releaseId) {
// 2. Download and extract
await AppSpacerCapacitor.downloadAndApply({
packageUrl: update.packageUrl,
hash: update.hash,
releaseId: update.releaseId,
});
// 3. Reload to apply
await AppSpacer.reload();
}API Reference
| Method | Description |
|---|---|
AppSpacer.init(config) | Initialize the plugin |
AppSpacer.sync() | Full check → download → apply flow |
AppSpacer.checkForUpdate() | Check server for an available update |
AppSpacer.reload() | Reload the WebView |
AppSpacer.resetToBuiltIn() | Remove OTA bundle and revert to bundled app |
AppSpacer.getDeviceId() | Get the unique device identifier |
Backend Integration
The Capacitor SDK uses the standard update check endpoint:
POST /api/sdk/capacitor/check
Body: { deployment_key, app_version, package_hash, install_id }
POST /api/sdk/capacitor/report-status
Body: { release_id, device_id, app_version, status, error_message }Returns { update_available: true, package_url, hash, release_id, mandatory } when an update is available.
Push a new web bundle (zip of your www/ directory) via the dashboard or CLI with --platform capacitor.
Deploying Updates
# Build your Ionic/Capacitor app
ionic build --prod
# Zip the www directory
zip -r update.zip www/
# Push via AppSpacer CLI
appspacer push -a my-app -d Production -p capacitor --bundle update.zipLast updated on