Skip to main content

Migrating from Cordova to Capacitor-based SDK

Regardless of the product you use with Live Updates, it’s easy to migrate to Capacitor-based Live Updates SDK and/or native libraries. The Capacitor-based Live Updates SDK relies on a new manifest differentials file, live-update-manifest.json. For reference, the Cordova SDK leverages a pro-manifest.json manifest file. Appflow now builds both manifest files in order to provide a seamless transition to your end users.

Cordova or Capacitor app

Perhaps unsurprisingly, the new Capacitor-based Live Updates SDK, @capacitor/live-updates, requires Capacitor. First, remove the Cordova cordova-plugin-ionic from your project.

npm uninstall cordova-plugin-ionic

If you're working in a Capacitor project already, remove any Cordova Live Updates-related preferences from capacitor.config.ts:

"cordova": {
"preferences": {
"DisableDeploy": "true"
}
}

Finally, sync the project to remove the SDK and configuration from the native projects.

npx cap sync

Next, remove the following Cordova SDK configuration variables from the iOS project in ios/App/App/Info.plist:

<key>IonAppId</key>
<string>YOUR_APP_ID</string>
<key>IonChannelName</key>
<string>CHANNEL_NAME</string>
<key>IonUpdateMethod</key>
<string>background</string>
<key>IonMaxVersions</key>
<string>2</string>
<key>IonMinBackgroundDuration</key>
<string>30</string>
<key>IonApi</key>
<string>https://api.ionicjs.com</string>

For reference, the Capacitor SDK writes configuration values here: ios/App/App/capacitor.config.json.

Next, remove the following Cordova SDK configuration variables from the Android project in android/app/src/main/res/values/strings.xml:

<string name="ionic_app_id">YOUR_APP_ID</string>
<string name="ionic_channel_name">CHANNEL_NAME</string>
<string name="ionic_update_method">background</string>
<string name="ionic_max_versions">2</string>
<string name="ionic_min_background_duration">30</string>
<string name="ionic_update_api">https://api.ionicjs.com</string>

For reference, the Capacitor SDK writes configuration values here: android/app/src/main/assets/capacitor.config.json.

With the Cordova SDK removed, migrate to Capacitor. Next, install and configure the Capacitor SDK see install details. Finally, a new app store binary release is required because of the SDK change. Ensure the latest web code/build is included in the native binary. Enjoy!

Since Appflow supports and ships both manifest files in a Live Update, your users won’t notice or be disrupted during the transition. If they are using a native binary with the Cordova SDK installed, the pro-manifest.json file will be used. If they update the native app and now have the Capacitor SDK installed, it will use the live-update-manifest.json file instead when applying a new live update.

SDK Configuration Differences

Optioncordova-plugin-ionic@capacitor/live-updatesNotes
Config fileconfig.xmlcapacitor.config.tsSDK configuration file.
Live Updates manifest filepro-manifest.jsonlive-update-manifest.jsonSee Manifest file details.
App Idapp-idappIdId representing an Appflow App.
Channelchannel-namechannelThe channel from which the device will receive updates.
Max Versionsmax-versionsmaxVersionsNumber of previous updates to cache on user's device.
Update Method/Strategybackground, auto, nonebackground, noneMore options are available. View Live Updates strategies.
Strategy algorithmn/astrategy (zip, differential)Whether the live update is a zip file or uses differentials.
Code Signingn/akeyThe public key used for code signing in self-hosted live updates.
Min Background Durationmin-background-durationn/aThe number of seconds the app needs to be in the background for it to have been considered "closed."
Turn off live updates for developmentDisableDeploy (true)enabled (false)Your code will get overwritten if the local app codebase points to the same channel as a deployed Live Update build.

Self-hosted Live Updates