Skip to content

Examples

Code for the setups people ask about most.

Basic OTA update check

Confirm the boot, then sync and reload when an update was installed.

await NativeUpdate.notifyAppReady();
const result = await NativeUpdate.sync();
if (result.status === 'UPDATE_INSTALLED') {
  await NativeUpdate.reload();
}

Prompt before applying

Ask the user before you interrupt them, unless the release is mandatory.

const result = await NativeUpdate.sync();
if (result.status === 'UPDATE_INSTALLED') {
  const go = result.mandatory || (await askTheUser(result.version));
  if (go) await NativeUpdate.reload();
}

App store update check

When a release needs native code, offer the store update.

const info = await NativeUpdate.getAppUpdateInfo();
if (info.updateAvailable) {
  await NativeUpdate.openAppStore();
}

In-app review

Ask for a rating with the store’s own prompt.

await NativeUpdate.requestReview();

Release from CI

Sign, upload and start at 5% in one job.

npx native-update deploy ./dist --app com.example.app --rollout 5 --wait

The full quick start is in the docs (opens in a new tab)