Installation
Set up @hotcodepush/cordova-code-push with an AI agent, with npx hotcodepush init or by hand in four steps, then check the setup with doctor.
Install @hotcodepush/cordova-code-push in one of three ways: let an AI agent do it, run npx hotcodepush init, or follow the steps by hand. You need a Cordova app on cordova-ios 8 and cordova-android 14 or 15 (Supported versions), Node on every build machine and an app in the console.
AI-assisted setup (recommended)
Install the HotCodePush skills:
npx skills add hotcodepush-team/skillsThen paste the prompt into your coding agent:
Set up HotCodePush in this project: install the skills with `npx skills add hotcodepush-team/skills`, then run the hotcodepush-init skill and the hotcodepush-release skill, following https://hotcodepush.com/docs/ai.The agent installs the SDK, creates the app and ships a first update. Agent skills explains what the agent does.
Set up with the CLI
npx hotcodepush initinit runs cordova plugin add, writes hotcodepush.json and signs you in. There is nothing to wire, since the plugin brings its own build step. init lists every step. Run it again after a manual step: it finishes only what is missing.
Manual setup
If init already ran, skip to step 3.
1. Install the package
npm install --save-dev hotcodepush
npx cordova plugin add @hotcodepush/cordova-code-pushcordova plugin add records the plugin in package.json and adds it to every platform the project has, and a platform added later gets it from that list. The CLI is a dev dependency: the plugin's Xcode phase and Gradle task run npx hotcodepush inside every native build. The bridge and the core are Kotlin, so the plugin sets GradlePluginKotlinEnabled and GradlePluginKotlinVersion in the platform's config.xml. A preference of either name in your own config.xml wins.
A TypeScript project gets the global HotCodePush and the result types with an import type:
import type { SyncResult } from '@hotcodepush/cordova-code-push';
document.addEventListener('deviceready', async () => {
const result: SyncResult = await HotCodePush.sync();
console.log(result.status);
});2. Add hotcodepush.json
{
"appId": "4f2b7c9e-8d31-4a6e-9b0f-2c5d7e8a1b34",
"channel": "production"
}The file sits in the project root, next to package.json and config.xml. appId is on the app's page in the console, and channel is the channel this build follows. Every other key has a default. Configuration lists them.
3. Build once
npm run build
npx cordova prepare
npx cordova build android
npx cordova build ioscordova prepare copies www into each platform and runs the plugin's hook, which adds the Xcode phase, and the plugin's Gradle file registers the Android task. Every build then writes hotcodepush.json into the built app and a store build creates the binary. binary says what the step writes and needs. Log in first with npx hotcodepush login, or export HOTCODEPUSH_TOKEN, so the file names your channel.
4. Verify with doctor
npx hotcodepush doctordoctor reports each check as ok, skipped or failed, with the step that repairs a failure. doctor lists the checks.
5. Release a first update
Change something visible in www, build it and release it to the channel:
npm run build
npx hotcodepush release createThe device applies the release at its next start. release has every option. If nothing happens, see Troubleshooting.
Platform notes
AndroidInsecureFileModeEnabledloads the app fromfile://, where no update can be served: the plugin stays off and rejects every method, as Errors shows. Leave the preference out ofconfig.xml.doctorflags it.- Builds: an archive, Product › Archive or
cordova build ios --device, and an Android build of a type other thandebugcreate the binary. A simulator build, an emulator run and every debug build write the file and create nothing, so their first update is the full pack. Debug builds embedwwwand take updates by default. SetisEnabledInDebugBuildstofalseonce the setup is verified. - Node for Xcode: Xcode's
PATHhas no Node. The phase takes thenodeof a build started from a shell, readsNODE_BINARYfromplatforms/ios/.xcode.env, or searches nvm, fnm, Volta, asdf and Homebrew. A build that finds none fails with the line to add. - Android: the SDK's manifest declares
INTERNETandACCESS_NETWORK_STATE, nothing to add. An app that setsandroid:fullBackupContentorandroid:dataExtractionRulesitself hits a manifest merger conflict. Addtools:replacefor the attribute on<application>through an<edit-config>inconfig.xml, and excludehotcodepush/underdomain="file"in both<cloud-backup>and<device-transfer>. - The native glue:
cordova.js,cordova_plugins.jsand everything underplugins/always come from the installed binary, never from a release, andlocation.reload()and a dev server's live reload apply nothing. The SDK ships its privacy manifest. Privacy and device data has the App Privacy answers.
Next steps
- Configuration lists every key of
hotcodepush.jsonand the strategies that decide when an update is checked, downloaded and applied. - API documents the methods, events and types on
window.HotCodePush, with every status and reason. - Sign your bundles sets up a key pair whose public key goes into
hotcodepush.json, so a device applies only what you signed.
Last updated on