Skip to content

Cap-go/capacitor-updater

Capacitor updater

Capgo - Instant updates for capacitor Discord Discord npm GitHub latest commit https://good-labs.github.io/greater-good-affirmation/assets/images/badge.svg Security Rating Bugs Maintainability Rating Code Smells Vulnerabilities Quality Gate Status Technical Debt Open Bounties Rewarded Bounties

Capacitor plugin to update your app remotely in real-time.

Open-source Alternative to Appflow, Codepush or Capawesome

Why Capacitor Updater?

App store review processes can take days or weeks, blocking critical bug fixes and updates from reaching your users. Capacitor Updater solves this by:

  • Instant updates - Push JavaScript/HTML/CSS updates directly to users without app store review
  • Delta updates - Only download changed files, making updates ultra-fast
  • Rollback protection - Automatically revert broken updates to keep your app stable
  • Open source - Self-host or use Capgo Cloud, with full control over your update infrastructure
  • Battle-tested - Used by 3000+ production apps with proven reliability
  • Most stared - Capacitor updater is the most stared Capacitor plugin on GitHub

Perfect for fixing bugs immediately, A/B testing features, and maintaining control over your release schedule.

Features

  • ☁️ Cloud / Self hosted Support: Use our Cloud to manage your app updates or yours.
  • 📦 Bundle Management: Download, assign to channel, rollback.
  • 📺 Channel Support: Use channels to manage different environments.
  • 🎯 Set Channel to specific device to do QA or debug one user.
  • 🔄 Auto Update: Automatically download and set the latest bundle for the app.
  • 🛟 Rollback: Reset the app to last working bundle if an incompatible bundle has been set.
  • 🔁 Delta Updates: Make instant updates by only downloading changed files.
  • 🔒 Security: Encrypt and sign each updates with best in class security standards.
  • ⚔️ Battle-Tested: Used in more than 3000 projects.
  • 📊 View your deployment statistics
  • 🔋 Supports Android and iOS
  • ⚡️ Capacitor 6/7 support
  • 🌐 Open Source: Licensed under the Mozilla Public License 2.0
  • 🌐 Open Source Backend: Self install our backend in your infra

You have 3 ways possible :

  • Use capgo.app a full featured auto-update system in 5 min Setup, to manage version, update, revert and see stats.
  • Use your own server update with auto-update system
  • Use manual methods to zip, upload, download, from JS to do it when you want.

Documentation

The most complete documentation here.

Community

Join the discord to get help.

Migration to v7

Compatibility

Plugin version Capacitor compatibility Maintained
v7.*.* v7.*.*
v6.*.* v6.*.*
v5.*.* v5.*.* ⚠️ Deprecated
v4.*.* v4.*.* ⚠️ Deprecated
v3.*.* v3.*.* ⚠️ Deprecated
> 7 v4.*.* ⚠️ Deprecated, our CI got crazy and bumped too much version

iOS

Privacy manifest

Add the NSPrivacyAccessedAPICategoryUserDefaults dictionary key to your Privacy Manifest (usually ios/App/PrivacyInfo.xcprivacy):

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>
    <key>NSPrivacyAccessedAPITypes</key>
    <array>
      <!-- Add this dict entry to the array if the file already exists. -->
      <dict>
        <key>NSPrivacyAccessedAPIType</key>
        <string>NSPrivacyAccessedAPICategoryUserDefaults</string>
        <key>NSPrivacyAccessedAPITypeReasons</key>
        <array>
          <string>CA92.1</string>
        </array>
      </dict>
    </array>
  </dict>
</plist>

We recommend to declare CA92.1 as the reason for accessing the UserDefaults API.

Installation

Step by step here: Getting started

Or

npm install @capgo/capacitor-updater
npx cap sync

Auto-update setup

Create your account in capgo.app and get your API key

  • Login to CLI npx @capgo/cli@latest init API_KEY And follow the steps by step to setup your app.

For detailed instructions on the auto-update setup, refer to the Auto update documentation.

No Cloud setup

Download update distribution zipfiles from a custom URL. Manually control the entire update process.

  • Edit your capacitor.config.json like below, set autoUpdate to false.
// capacitor.config.json
{
	"appId": "**.***.**",
	"appName": "Name",
	"plugins": {
		"CapacitorUpdater": {
			"autoUpdate": false,
		}
	}
}
  • Add to your main code
  import { CapacitorUpdater } from '@capgo/capacitor-updater'
  CapacitorUpdater.notifyAppReady()

This informs Capacitor Updater that the current update bundle has loaded successfully. Failing to call this method will cause your application to be rolled back to the previously successful version (or built-in bundle).

  • Add this to your application.
  const version = await CapacitorUpdater.download({
    version: '0.0.4',
    url: 'https://github.com/Cap-go/demo-app/releases/download/0.0.4/dist.zip',
  })
  await CapacitorUpdater.set(version); // sets the new version, and reloads the app
  • Failed updates will automatically roll back to the last successful version.
  • Example: Using App-state to control updates, with SplashScreen: You might also consider performing auto-update when application state changes, and using the Splash Screen to improve user experience.
  import { CapacitorUpdater, VersionInfo } from '@capgo/capacitor-updater'
  import { SplashScreen } from '@capacitor/splash-screen'
  import { App } from '@capacitor/app'

  let version: VersionInfo;
  App.addListener('appStateChange', async (state) => {
      if (state.isActive) {
        // Ensure download occurs while the app is active, or download may fail
        version = await CapacitorUpdater.download({
          version: '0.0.4',
          url: 'https://github.com/Cap-go/demo-app/releases/download/0.0.4/dist.zip',
        })
      }

      if (!state.isActive && version) {
        // Activate the update when the application is sent to background
        SplashScreen.show()
        try {
          await CapacitorUpdater.set(version);
          // At this point, the new version should be active, and will need to hide the splash screen
        } catch () {
          SplashScreen.hide() // Hide the splash screen again if something went wrong
        }
      }
  })

TIP: If you prefer a secure and automated way to update your app, you can use capgo.app - a full-featured, auto-update system.

Store Guideline Compliance

Android Google Play and iOS App Store have corresponding guidelines that have rules you should be aware of before integrating the Capacitor-updater solution within your application.

Google play

Third paragraph of Device and Network Abuse topic describe that updating source code by any method besides Google Play's update mechanism is restricted. But this restriction does not apply to updating JavaScript bundles.

This restriction does not apply to code that runs in a virtual machine and has limited access to Android APIs (such as JavaScript in a web view or browser).

That fully allow Capacitor-updater as it updates just JS bundles and can't update native code part.

App Store

Paragraph 3.3.2, since back in 2015's Apple Developer Program License Agreement fully allowed performing over-the-air updates of JavaScript and assets.

And in its latest version (20170605) downloadable here this ruling is even broader:

Interpreted code may be downloaded to an Application, but only so long as such code:

  • (a) does not change the primary purpose of the Application by providing features or functionality that are inconsistent with the intended and advertised purpose of the Application as submitted to the App Store
  • (b) does not create a store or storefront for other code or applications
  • (c) does not bypass signing, sandbox, or other security features of the OS.

Capacitor-updater allows you to respect these rules in full compliance, so long as the update you push does not significantly deviate your product from its original App Store approved intent.

To further remain in compliance with Apple's guidelines, we suggest that App Store-distributed apps don't enable the Force update scenario, since in the App Store Review Guidelines it is written that:

Apps must not force users to rate the app, review the app, download other apps, or other similar actions to access functionality, content, or use of the app.

This is not a problem for the default behavior of background update, since it won't force the user to apply the new version until the next app close, but at least you should be aware of that ruling if you decide to show it.

Packaging dist.zip update bundles

Capacitor Updater works by unzipping a compiled app bundle to the native device filesystem. Whatever you choose to name the file you upload/download from your release/update server URL (via either manual or automatic updating), this .zip bundle must meet the following requirements:

  • The zip file should contain the full contents of your production Capacitor build output folder, usually {project directory}/dist/ or {project directory}/www/. This is where index.html will be located, and it should also contain all bundled JavaScript, CSS, and web resources necessary for your app to run.
  • Do not password encrypt the bundle zip file, or it will fail to unpack.
  • Make sure the bundle does not contain any extra hidden files or folders, or it may fail to unpack.

Updater Plugin Config

CapacitorUpdater can be configured with these options:

Prop Type Description Default Since
appReadyTimeout number Configure the number of milliseconds the native plugin should wait before considering an update 'failed'. Only available for Android and iOS. 10000 // (10 seconds)
responseTimeout number Configure the number of seconds the native plugin should wait before considering API timeout. Only available for Android and iOS. 20 // (20 second)
autoDeleteFailed boolean Configure whether the plugin should use automatically delete failed bundles. Only available for Android and iOS. true
autoDeletePrevious boolean Configure whether the plugin should use automatically delete previous bundles after a successful update. Only available for Android and iOS. true
autoUpdate boolean Configure whether the plugin should use Auto Update via an update server. Only available for Android and iOS. true
resetWhenUpdate boolean Automatically delete previous downloaded bundles when a newer native app bundle is installed to the device. Only available for Android and iOS. true
updateUrl string Configure the URL / endpoint to which update checks are sent. Only available for Android and iOS. https://plugin.capgo.app/updates
channelUrl string Configure the URL / endpoint for channel operations. Only available for Android and iOS. https://plugin.capgo.app/channel_self
statsUrl string Configure the URL / endpoint to which update statistics are sent. Only available for Android and iOS. Set to "" to disable stats reporting. https://plugin.capgo.app/stats
publicKey string Configure the public key for end to end live update encryption Version 2 Only available for Android and iOS. undefined 6.2.0
version string Configure the current version of the app. This will be used for the first update request. If not set, the plugin will get the version from the native code. Only available for Android and iOS. undefined 4.17.48
directUpdate boolean | 'always' | 'atInstall' | 'onLaunch' Configure when the plugin should direct install updates. Only for autoUpdate mode. Works well for apps less than 10MB and with uploads done using --partial flag. Zip or apps more than 10MB will be relatively slow for users to update. - false: Never do direct updates (use default behavior: download at start, set when backgrounded) - atInstall: Direct update only when app is installed, updated from store, otherwise act as directUpdate = false - onLaunch: Direct update only on app installed, updated from store or after app kill, otherwise act as directUpdate = false - always: Direct update in all previous cases (app installed, updated from store, after app kill or app resume), never act as directUpdate = false - true: (deprecated) Same as "always" for backward compatibility Only available for Android and iOS. false 5.1.0
autoSplashscreen boolean Automatically handle splashscreen hiding when using directUpdate. When enabled, the plugin will automatically hide the splashscreen after updates are applied or when no update is needed. This removes the need to manually listen for appReady events and call SplashScreen.hide(). Only works when directUpdate is set to "atInstall", "always", "onLaunch", or true. Requires the @capacitor/splash-screen plugin to be installed and configured with launchAutoHide: false. Requires autoUpdate and directUpdate to be enabled. Only available for Android and iOS. false 7.6.0
autoSplashscreenLoader boolean Display a native loading indicator on top of the splashscreen while automatic direct updates are running. Only takes effect when {@link autoSplashscreen} is enabled. Requires the @capacitor/splash-screen plugin to be installed and configured with launchAutoHide: false. Only available for Android and iOS. false 7.19.0
autoSplashscreenTimeout number Automatically hide the splashscreen after the specified number of milliseconds when using automatic direct updates. If the timeout elapses, the update continues to download in the background while the splashscreen is dismissed. Set to 0 (zero) to disable the timeout. When the timeout fires, the direct update flow is skipped and the downloaded bundle is installed on the next background/launch. Requires {@link autoSplashscreen} to be enabled. Only available for Android and iOS. 10000 // (10 seconds) 7.19.0
periodCheckDelay number Configure the delay period for period update check. the unit is in seconds. Only available for Android and iOS. Cannot be less than 600 seconds (10 minutes). 0 (disabled)
localS3 boolean Configure the CLI to use a local server for testing or self-hosted update server. undefined 4.17.48
localHost string Configure the CLI to use a local server for testing or self-hosted update server. undefined 4.17.48
localWebHost string Configure the CLI to use a local server for testing or self-hosted update server. undefined 4.17.48
localSupa string Configure the CLI to use a local server for testing or self-hosted update server. undefined 4.17.48
localSupaAnon string Configure the CLI to use a local server for testing. undefined 4.17.48
localApi string Configure the CLI to use a local api for testing. undefined 6.3.3
localApiFiles string Configure the CLI to use a local file api for testing. undefined 6.3.3
allowModifyUrl boolean Allow the plugin to modify the updateUrl, statsUrl and channelUrl dynamically from the JavaScript side. false 5.4.0
allowModifyAppId boolean Allow the plugin to modify the appId dynamically from the JavaScript side. false 7.14.0
allowManualBundleError boolean Allow marking bundles as errored from JavaScript while using manual update flows. When enabled, {@link CapacitorUpdaterPlugin.setBundleError} can change a bundle status to error. false 7.20.0
persistCustomId boolean Persist the customId set through {@link CapacitorUpdaterPlugin.setCustomId} across app restarts. Only available for Android and iOS. false (will be true by default in a future major release v8.x.x) 7.17.3
persistModifyUrl boolean Persist the updateUrl, statsUrl and channelUrl set through {@link CapacitorUpdaterPlugin.setUpdateUrl}, {@link CapacitorUpdaterPlugin.setStatsUrl} and {@link CapacitorUpdaterPlugin.setChannelUrl} across app restarts. Only available for Android and iOS. false 7.20.0
defaultChannel string Set the default channel for the app in the config. Case sensitive. This will setting will override the default channel set in the cloud, but will still respect overrides made in the cloud. This requires the channel to allow devices to self dissociate/associate in the channel settings. https://capgo.app/docs/public-api/channels/#channel-configuration-options undefined 5.5.0
appId string Configure the app id for the app in the config. undefined 6.0.0
keepUrlPathAfterReload boolean Configure the plugin to keep the URL path after a reload. WARNING: When a reload is triggered, 'window.history' will be cleared. false 6.8.0
disableJSLogging boolean Disable the JavaScript logging of the plugin. if true, the plugin will not log to the JavaScript console. only the native log will be done false 7.3.0
shakeMenu boolean Enable shake gesture to show update menu for debugging/testing purposes false 7.5.0

Examples

In capacitor.config.json:

{
  "plugins": {
    "CapacitorUpdater": {
      "appReadyTimeout": 1000 // (1 second),
      "responseTimeout": 10 // (10 second),
      "autoDeleteFailed": false,
      "autoDeletePrevious": false,
      "autoUpdate": false,
      "resetWhenUpdate": false,
      "updateUrl": https://example.com/api/auto_update,
      "channelUrl": https://example.com/api/channel,
      "statsUrl": https://example.com/api/stats,
      "publicKey": undefined,
      "version": undefined,
      "directUpdate": undefined,
      "autoSplashscreen": undefined,
      "autoSplashscreenLoader": undefined,
      "autoSplashscreenTimeout": undefined,
      "periodCheckDelay": 3600 (1 hour),
      "localS3": undefined,
      "localHost": undefined,
      "localWebHost": undefined,
      "localSupa": undefined,
      "localSupaAnon": undefined,
      "localApi": undefined,
      "localApiFiles": undefined,
      "allowModifyUrl": undefined,
      "allowModifyAppId": undefined,
      "allowManualBundleError": undefined,
      "persistCustomId": undefined,
      "persistModifyUrl": undefined,
      "defaultChannel": undefined,
      "appId": undefined,
      "keepUrlPathAfterReload": undefined,
      "disableJSLogging": undefined,
      "shakeMenu": undefined
    }
  }
}

In capacitor.config.ts:

/// <reference types="@capgo/capacitor-updater" />

import { CapacitorConfig } from '@capacitor/cli';

const config: CapacitorConfig = {
  plugins: {
    CapacitorUpdater: {
      appReadyTimeout: 1000 // (1 second),
      responseTimeout: 10 // (10 second),
      autoDeleteFailed: false,
      autoDeletePrevious: false,
      autoUpdate: false,
      resetWhenUpdate: false,
      updateUrl: https://example.com/api/auto_update,
      channelUrl: https://example.com/api/channel,
      statsUrl: https://example.com/api/stats,
      publicKey: undefined,
      version: undefined,
      directUpdate: undefined,
      autoSplashscreen: undefined,
      autoSplashscreenLoader: undefined,
      autoSplashscreenTimeout: undefined,
      periodCheckDelay: 3600 (1 hour),
      localS3: undefined,
      localHost: undefined,
      localWebHost: undefined,
      localSupa: undefined,
      localSupaAnon: undefined,
      localApi: undefined,
      localApiFiles: undefined,
      allowModifyUrl: undefined,
      allowModifyAppId: undefined,
      allowManualBundleError: undefined,
      persistCustomId: undefined,
      persistModifyUrl: undefined,
      defaultChannel: undefined,
      appId: undefined,
      keepUrlPathAfterReload: undefined,
      disableJSLogging: undefined,
      shakeMenu: undefined,
    },
  },
};

export default config;

API

notifyAppReady()

notifyAppReady() => Promise<AppReadyResult>

Notify the native layer that JavaScript initialized successfully.

CRITICAL: You must call this method on every app launch to prevent automatic rollback.

This is a simple notification to confirm that your bundle's JavaScript loaded and executed. The native web server successfully served the bundle files and your JS runtime started. That's all it checks - nothing more complex.

What triggers rollback:

  • NOT calling this method within the timeout (default: 10 seconds)
  • Complete JavaScript failure (bundle won't load at all)

What does NOT trigger rollback:

  • Runtime errors after initialization (API failures, crashes, etc.)
  • Network request failures
  • Application logic errors

IMPORTANT: Call this BEFORE any network requests. Don't wait for APIs, data loading, or async operations. Call it as soon as your JavaScript bundle starts executing to confirm the bundle itself is valid.

Best practices:

  • Call immediately in your app entry point (main.js, app component mount, etc.)
  • Don't put it after network calls or heavy initialization
  • Don't wrap it in try/catch with conditions
  • Adjust {@link PluginsConfig.CapacitorUpdater.appReadyTimeout} if you need more time

Returns: Promise<AppReadyResult>


setUpdateUrl(...)

setUpdateUrl(options: UpdateUrl) => Promise<void>

Set the update URL for the app dynamically at runtime.

This overrides the {@link PluginsConfig.CapacitorUpdater.updateUrl} config value. Requires {@link PluginsConfig.CapacitorUpdater.allowModifyUrl} to be set to true.

Use {@link PluginsConfig.CapacitorUpdater.persistModifyUrl} to persist this value across app restarts. Otherwise, the URL will reset to the config value on next app launch.

Param Type Description
options UpdateUrl Contains the URL to use for checking for updates.

Since: 5.4.0


setStatsUrl(...)

setStatsUrl(options: StatsUrl) => Promise<void>

Set the statistics URL for the app dynamically at runtime.

This overrides the {@link PluginsConfig.CapacitorUpdater.statsUrl} config value. Requires {@link PluginsConfig.CapacitorUpdater.allowModifyUrl} to be set to true.

Pass an empty string to disable statistics gathering entirely. Use {@link PluginsConfig.CapacitorUpdater.persistModifyUrl} to persist this value across app restarts.

Param Type Description
options StatsUrl Contains the URL to use for sending statistics, or an empty string to disable.

Since: 5.4.0


setChannelUrl(...)

setChannelUrl(options: ChannelUrl) => Promise<void>

Set the channel URL for the app dynamically at runtime.

This overrides the {@link PluginsConfig.CapacitorUpdater.channelUrl} config value. Requires {@link PluginsConfig.CapacitorUpdater.allowModifyUrl} to be set to true.

Use {@link PluginsConfig.CapacitorUpdater.persistModifyUrl} to persist this value across app restarts. Otherwise, the URL will reset to the config value on next app launch.

Param Type Description
options ChannelUrl Contains the URL to use for channel operations.

Since: 5.4.0


download(...)

download(options: DownloadOptions) => Promise<BundleInfo>

Download a new bundle from the provided URL for later installation.

The downloaded bundle is stored locally but not activated. To use it:

  • Call {@link next} to set it for installation on next app backgrounding/restart
  • Call {@link set} to activate it immediately (destroys current JavaScript context)

The URL should point to a zip file containing either:

  • Your app files directly in the zip root, or
  • A single folder containing all your app files

The bundle must include an index.html file at the root level.

For encrypted bundles, provide the sessionKey and checksum parameters. For multi-file partial updates, provide the manifest array.

Param Type Description
options DownloadOptions The {@link DownloadOptions} for downloading a new bundle zip.

Returns: Promise<BundleInfo>


next(...)

next(options: BundleId) => Promise<BundleInfo>

Set the next bundle to be activated when the app backgrounds or restarts.

This is the recommended way to apply updates as it doesn't interrupt the user's current session. The bundle will be activated when:

  • The app is backgrounded (user switches away), or
  • The app is killed and relaunched, or
  • {@link reload} is called manually

Unlike {@link set}, this method does NOT destroy the current JavaScript context immediately. Your app continues running normally until one of the above events occurs.

Use {@link setMultiDelay} to add additional conditions before the update is applied.

Param Type Description
options BundleId Contains the ID of the bundle to set as next. Use {@link BundleInfo.id} from a downloaded bundle.

Returns: Promise<BundleInfo>


set(...)

set(options: BundleId) => Promise<void>

Set the current bundle and immediately reloads the app.

IMPORTANT: This is a terminal operation that destroys the current JavaScript context.

When you call this method:

  • The entire JavaScript context is immediately destroyed
  • The app reloads from a different folder with different files
  • NO code after this call will execute
  • NO promises will resolve
  • NO callbacks will fire
  • Event listeners registered after this call are unreliable and may never fire

The reload happens automatically - you don't need to do anything else. If you need to preserve state like the current URL path, use the {@link PluginsConfig.CapacitorUpdater.keepUrlPathAfterReload} config option. For other state preservation needs, save your data before calling this method (e.g., to localStorage).

Do not try to execute additional logic after calling set() - it won't work as expected.

Param Type Description
options BundleId A {@link BundleId} object containing the new bundle id to set as current.

delete(...)

delete(options: BundleId) => Promise<void>

Delete a bundle from local storage to free up disk space.

You cannot delete:

  • The currently active bundle
  • The builtin bundle (the version shipped with your app)
  • The bundle set as next (call {@link next} with a different bundle first)

Use {@link list} to get all available bundle IDs.

Note: The bundle ID is NOT the same as the version name. Use the id field from {@link BundleInfo}, not the version field.

Param Type Description
options BundleId A {@link BundleId} object containing the bundle ID to delete.

setBundleError(...)

setBundleError(options: BundleId) => Promise<BundleInfo>

Manually mark a bundle as failed/errored in manual update mode.

This is useful when you detect that a bundle has critical issues and want to prevent it from being used again. The bundle status will be changed to error and the plugin will avoid using this bundle in the future.

Requirements:

  • {@link PluginsConfig.CapacitorUpdater.allowManualBundleError} must be set to true
  • Only works in manual update mode (when autoUpdate is disabled)

Common use case: After downloading and testing a bundle, you discover it has critical bugs and want to mark it as failed so it won't be retried.

Param Type Description
options BundleId A {@link BundleId} object containing the bundle ID to mark as errored.

Returns: Promise<BundleInfo>

Since: 7.20.0


list(...)

list(options?: ListOptions | undefined) => Promise<BundleListResult>

Get all locally downloaded bundles stored in your app.

This returns all bundles that have been downloaded and are available locally, including:

  • The currently active bundle
  • The builtin bundle (shipped with your app)
  • Any downloaded bundles waiting to be activated
  • Failed bundles (with error status)

Use this to:

  • Check available disk space by counting bundles
  • Delete old bundles with {@link delete}
  • Monitor bundle download status
Param Type Description
options ListOptions The {@link ListOptions} for customizing the bundle list output.

Returns: Promise<BundleListResult>


reset(...)

reset(options?: ResetOptions | undefined) => Promise<void>

Reset the app to a known good bundle.

This method helps recover from problematic updates by reverting to either:

  • The builtin bundle (the original version shipped with your app to App Store/Play Store)
  • The last successfully loaded bundle (most recent bundle that worked correctly)

IMPORTANT: This triggers an immediate app reload, destroying the current JavaScript context. See {@link set} for details on the implications of this operation.

Use cases:

  • Emergency recovery when an update causes critical issues
  • Testing rollback functionality
  • Providing users a "reset to factory" option
Param Type
options ResetOptions

current()

current() => Promise<CurrentBundleResult>

Get information about the currently active bundle.

Returns:

  • bundle: The currently active bundle information
  • native: The version of the builtin bundle (the original app version from App/Play Store)

If no updates have been applied, bundle.id will be "builtin", indicating the app is running the original version shipped with the native app.

Use this to:

  • Display the current version to users
  • Check if an update is currently active
  • Compare against available updates
  • Log the active bundle for debugging

Returns: Promise<CurrentBundleResult>


reload()

reload() => Promise<void>

Manually reload the app to apply a pending update.

This triggers the same reload behavior that happens automatically when the app backgrounds. If you've called {@link next} to queue an update, calling reload() will apply it immediately.

IMPORTANT: This destroys the current JavaScript context immediately. See {@link set} for details on the implications of this operation.

Common use cases:

  • Applying an update immediately after download instead of waiting for backgrounding
  • Providing a "Restart now" button to users after an update is ready
  • Testing update flows during development

If no update is pending (no call to {@link next}), this simply reloads the current bundle.


setMultiDelay(...)

setMultiDelay(options: MultiDelayConditions) => Promise<void>

Configure conditions that must be met before a pending update is applied.

After calling {@link next} to queue an update, use this method to control when it gets applied. The update will only be installed after ALL specified conditions are satisfied.

Available condition types:

  • background: Wait for the app to be backgrounded. Optionally specify duration in milliseconds.
  • kill: Wait for the app to be killed and relaunched (Note: Current behavior triggers update immediately on kill, not on next background. This will be fixed in v8.)
  • date: Wait until a specific date/time (ISO 8601 format)
  • nativeVersion: Wait until the native app is updated to a specific version

Condition value formats:

  • background: Number in milliseconds (e.g., "300000" for 5 minutes), or omit for immediate
  • kill: No value needed
  • date: ISO 8601 date string (e.g., "2025-12-31T23:59:59Z")
  • nativeVersion: Version string (e.g., "2.0.0")
Param Type Description
options MultiDelayConditions Contains the {@link MultiDelayConditions} array of conditions.

Since: 4.3.0


cancelDelay()

cancelDelay() => Promise<void>

Cancel all delay conditions and apply the pending update immediately.

If you've set delay conditions with {@link setMultiDelay}, this method clears them and triggers the pending update to be applied on the next app background or restart.

This is useful when:

  • User manually requests to update now (e.g., clicks "Update now" button)
  • Your app detects it's a good time to update (e.g., user finished critical task)
  • You want to override a time-based delay early

Since: 4.0.0


getLatest(...)

getLatest(options?: GetLatestOptions | undefined) => Promise<LatestVersion>

Check the update server for the latest available bundle version.

This queries your configured update URL (or Capgo backend) to see if a newer bundle is available for download. It does NOT download the bundle automatically.

The response includes:

  • version: The latest available version identifier
  • url: Download URL for the bundle (if available)
  • breaking: Whether this update is marked as incompatible (requires native app update)
  • message: Optional message from the server
  • manifest: File list for partial updates (if using multi-file downloads)

After receiving the latest version info, you can:

  1. Compare it with your current version
  2. Download it using {@link download}
  3. Apply it using {@link next} or {@link set}
Param Type Description
options GetLatestOptions Optional {@link GetLatestOptions} to specify which channel to check.

Returns: Promise<LatestVersion>

Since: 4.0.0


setChannel(...)

setChannel(options: SetChannelOptions) => Promise<ChannelRes>

Assign this device to a specific update channel at runtime.

Channels allow you to distribute different bundle versions to different groups of users (e.g., "production", "beta", "staging"). This method switches the device to a new channel.

Requirements:

  • The target channel must allow self-assignment (configured in your Capgo dashboard or backend)
  • The backend may accept or reject the request based on channel settings

When to use:

  • After the app is ready and the user has interacted (e.g., opted into beta program)
  • To implement in-app channel switching (beta toggle, tester access, etc.)
  • For user-driven channel changes

When NOT to use:

  • At app boot/initialization - use {@link PluginsConfig.CapacitorUpdater.defaultChannel} config instead
  • Before user interaction

This sends a request to the Capgo backend linking your device ID to the specified channel.

Param Type Description
options SetChannelOptions The {@link SetChannelOptions} containing the channel name and optional auto-update trigger.

Returns: Promise<ChannelRes>

Since: 4.7.0


unsetChannel(...)

unsetChannel(options: UnsetChannelOptions) => Promise<void>

Remove the device's channel assignment and return to the default channel.

This unlinks the device from any specifically assigned channel, causing it to fall back to:

  • The {@link PluginsConfig.CapacitorUpdater.defaultChannel} if configured, or
  • Your backend's default channel for this app

Use this when:

  • Users opt out of beta/testing programs
  • You want to reset a device to standard update distribution
  • Testing channel switching behavior
Param Type
options UnsetChannelOptions

Since: 4.7.0


getChannel()

getChannel() => Promise<GetChannelRes>

Get the current channel assigned to this device.

Returns information about:

  • channel: The currently assigned channel name (if any)
  • allowSet: Whether the channel allows self-assignment
  • status: Operation status
  • error/message: Additional information (if applicable)

Use this to:

  • Display current channel to users (e.g., "You're on the Beta channel")
  • Check if a device is on a specific channel before showing features
  • Verify channel assignment after calling {@link setChannel}

Returns: Promise<GetChannelRes>

Since: 4.8.0


listChannels()

listChannels() => Promise<ListChannelsResult>

Get a list of all channels available for this device to self-assign to.

Only returns channels where allow_self_set is true. These are channels that users can switch to using {@link setChannel} without backend administrator intervention.

Each channel includes:

  • id: Unique channel identifier
  • name: Human-readable channel name
  • public: Whether the channel is publicly visible
  • allow_self_set: Always true in results (filtered to only self-assignable channels)

Use this to:

  • Build a channel selector UI for users (e.g., "Join Beta" button)
  • Show available testing/preview channels
  • Implement channel discovery features

Returns: Promise<ListChannelsResult>

Since: 7.5.0


setCustomId(...)

setCustomId(options: SetCustomIdOptions) => Promise<void>

Set a custom identifier for this device.

This allows you to identify devices by your own custom ID (user ID, account ID, etc.) instead of or in addition to the device's unique hardware ID. The custom ID is sent to your update server and can be used for:

  • Targeting specific users for updates
  • Analytics and user tracking
  • Debugging and support (correlating devices with users)
  • A/B testing or feature flagging

Persistence:

  • When {@link PluginsConfig.CapacitorUpdater.persistCustomId} is true, the ID persists across app restarts
  • When false, the ID is only kept for the current session

Clearing the custom ID:

  • Pass an empty string "" to remove any stored custom ID
Param Type Description
options SetCustomIdOptions The {@link SetCustomIdOptions} containing the custom identifier string.

Since: 4.9.0


getBuiltinVersion()

getBuiltinVersion() => Promise<BuiltinVersion>

Get the builtin bundle version (the original version shipped with your native app).

This returns the version of the bundle that was included when the app was installed from the App Store or Play Store. This is NOT the currently active bundle version - use {@link current} for that.

Returns:

  • The {@link PluginsConfig.CapacitorUpdater.version} config value if set, or
  • The native app version from platform configs (package.json, Info.plist, build.gradle)

Use this to:

  • Display the "factory" version to users
  • Compare against downloaded bundle versions
  • Determine if any updates have been applied
  • Debugging version mismatches

Returns: Promise<BuiltinVersion>

Since: 5.2.0


getDeviceId()

getDeviceId() => Promise<DeviceId>

Get the unique, privacy-friendly identifier for this device.

This ID is used to identify the device when communicating with update servers. It's automatically generated and stored securely by the plugin.

Privacy & Security characteristics:

  • Generated as a UUID (not based on hardware identifiers)
  • Stored securely in platform-specific secure storage
  • Android: Android Keystore (persists across app reinstalls on API 23+)
  • iOS: Keychain with kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly
  • Not synced to cloud (iOS)
  • Follows Apple and Google privacy best practices
  • Users can clear it via system settings (Android) or keychain access (iOS)

Persistence: The device ID persists across app reinstalls to maintain consistent device identity for update tracking and analytics.

Use this to:

  • Debug update delivery issues (check what ID the server sees)
  • Implement device-specific features
  • Correlate server logs with specific devices

Returns: Promise<DeviceId>


getPluginVersion()

getPluginVersion() => Promise<PluginVersion>

Get the version of the Capacitor Updater plugin installed in your app.

This returns the version of the native plugin code (Android/iOS), which is sent to the update server with each request. This is NOT your app version or bundle version.

Use this to:

  • Debug plugin-specific issues (when reporting bugs)
  • Verify plugin installation and version
  • Check compatibility with backend features
  • Display in debug/about screens

Returns: Promise<PluginVersion>


isAutoUpdateEnabled()

isAutoUpdateEnabled() => Promise<AutoUpdateEnabled>

Check if automatic updates are currently enabled.

Returns true if {@link PluginsConfig.CapacitorUpdater.autoUpdate} is enabled, meaning the plugin will automatically check for, download, and apply updates.

Returns false if in manual mode, where you control the update flow using {@link getLatest}, {@link download}, {@link next}, and {@link set}.

Use this to:

  • Determine which update flow your app is using
  • Show/hide manual update UI based on mode
  • Debug update behavior

Returns: Promise<AutoUpdateEnabled>


removeAllListeners()

removeAllListeners() => Promise<void>

Remove all event listeners registered for this plugin.

This unregisters all listeners added via {@link addListener} for all event types:

  • download
  • noNeedUpdate
  • updateAvailable
  • downloadComplete
  • downloadFailed
  • breakingAvailable / majorAvailable
  • updateFailed
  • appReloaded
  • appReady

Use this during cleanup (e.g., when unmounting components or closing screens) to prevent memory leaks from lingering event listeners.

Since: 1.0.0


addListener('download', ...)

addListener(eventName: 'download', listenerFunc: (state: DownloadEvent) => void) => Promise<PluginListenerHandle>

Listen for bundle download event in the App. Fires once a download has started, during downloading and when finished. This will return you all download percent during the download

Param Type
eventName 'download'
listenerFunc (state: DownloadEvent) => void

Returns: Promise<PluginListenerHandle>

Since: 2.0.11


addListener('noNeedUpdate', ...)

addListener(eventName: 'noNeedUpdate', listenerFunc: (state: NoNeedEvent) => void) => Promise<PluginListenerHandle>

Listen for no need to update event, useful when you want force check every time the app is launched

Param Type
eventName 'noNeedUpdate'
listenerFunc (state: NoNeedEvent) => void

Returns: Promise<PluginListenerHandle>

Since: 4.0.0


addListener('updateAvailable', ...)

addListener(eventName: 'updateAvailable', listenerFunc: (state: UpdateAvailableEvent) => void) => Promise<PluginListenerHandle>

Listen for available update event, useful when you want to force check every time the app is launched

Param Type
eventName 'updateAvailable'
listenerFunc (state: UpdateAvailableEvent) => void

Returns: Promise<PluginListenerHandle>

Since: 4.0.0


addListener('downloadComplete', ...)

addListener(eventName: 'downloadComplete', listenerFunc: (state: DownloadCompleteEvent) => void) => Promise<PluginListenerHandle>

Listen for downloadComplete events.

Param Type
eventName 'downloadComplete'
listenerFunc (state: DownloadCompleteEvent) => void

Returns: Promise<PluginListenerHandle>

Since: 4.0.0


addListener('breakingAvailable', ...)

addListener(eventName: 'breakingAvailable', listenerFunc: (state: BreakingAvailableEvent) => void) => Promise<PluginListenerHandle>

Listen for breaking update events when the backend flags an update as incompatible with the current app. Emits the same payload as the legacy majorAvailable listener.

Param Type
eventName 'breakingAvailable'
listenerFunc (state: MajorAvailableEvent) => void

Returns: Promise<PluginListenerHandle>

Since: 7.22.0


addListener('majorAvailable', ...)

addListener(eventName: 'majorAvailable', listenerFunc: (state: MajorAvailableEvent) => void) => Promise<PluginListenerHandle>

Listen for Major update event in the App, let you know when major update is blocked by setting disableAutoUpdateBreaking

Param Type
eventName 'majorAvailable'
listenerFunc (state: MajorAvailableEvent) => void

Returns: Promise<PluginListenerHandle>

Since: 2.3.0


addListener('updateFailed', ...)

addListener(eventName: 'updateFailed', listenerFunc: (state: UpdateFailedEvent) => void) => Promise<PluginListenerHandle>

Listen for update fail event in the App, let you know when update has fail to install at next app start

Param Type
eventName 'updateFailed'
listenerFunc (state: UpdateFailedEvent) => void

Returns: Promise<PluginListenerHandle>

Since: 2.3.0


addListener('downloadFailed', ...)

addListener(eventName: 'downloadFailed', listenerFunc: (state: DownloadFailedEvent) => void) => Promise<PluginListenerHandle>

Listen for download fail event in the App, let you know when a bundle download has failed

Param Type
eventName 'downloadFailed'
listenerFunc (state: DownloadFailedEvent) => void

Returns: Promise<PluginListenerHandle>

Since: 4.0.0


addListener('appReloaded', ...)

addListener(eventName: 'appReloaded', listenerFunc: () => void) => Promise<PluginListenerHandle>

Listen for reload event in the App, let you know when reload has happened

Param Type
eventName 'appReloaded'
listenerFunc () => void

Returns: Promise<PluginListenerHandle>

Since: 4.3.0


addListener('appReady', ...)

addListener(eventName: 'appReady', listenerFunc: (state: AppReadyEvent) => void) => Promise<PluginListenerHandle>

Listen for app ready event in the App, let you know when app is ready to use, this event is retain till consumed.

Param Type
eventName 'appReady'
listenerFunc (state: AppReadyEvent) => void

Returns: Promise<PluginListenerHandle>

Since: 5.1.0


isAutoUpdateAvailable()

isAutoUpdateAvailable() => Promise<AutoUpdateAvailable>

Check if the auto-update feature is available (not disabled by custom server configuration).

Returns false when a custom updateUrl is configured, as this typically indicates you're using a self-hosted update server that may not support all auto-update features.

Returns true when using the default Capgo backend or when the feature is available.

This is different from {@link isAutoUpdateEnabled}:

  • isAutoUpdateEnabled(): Checks if auto-update MODE is turned on/off
  • isAutoUpdateAvailable(): Checks if auto-update is SUPPORTED with your current configuration

Returns: Promise<AutoUpdateAvailable>


getNextBundle()

getNextBundle() => Promise<BundleInfo | null>

Get information about the bundle queued to be activated on next reload.

Returns:

  • {@link BundleInfo} object if a bundle has been queued via {@link next}
  • null if no update is pending

This is useful to:

  • Check if an update is waiting to be applied
  • Display "Update pending" status to users
  • Show version info of the queued update
  • Decide whether to show a "Restart to update" prompt

The queued bundle will be activated when:

  • The app is backgrounded (default behavior)
  • The app is killed and restarted
  • {@link reload} is called manually
  • Delay conditions set by {@link setMultiDelay} are met

Returns: Promise<BundleInfo | null>

Since: 6.8.0


getFailedUpdate()

getFailedUpdate() => Promise<UpdateFailedEvent | null>

Retrieve information about the most recent bundle that failed to load.

When a bundle fails to load (e.g., JavaScript errors prevent initialization, missing files), the plugin automatically rolls back and stores information about the failure. This method retrieves that failure information.

IMPORTANT: The stored value is cleared after being retrieved once. Calling this method multiple times will only return the failure info on the first call, then null on subsequent calls until another failure occurs.

Returns:

  • {@link UpdateFailedEvent} with bundle info if a failure was recorded
  • null if no failure has occurred or if it was already retrieved

Use this to:

  • Show users why an update failed
  • Log failure information for debugging
  • Implement custom error handling/reporting
  • Display rollback notifications

Returns: Promise<UpdateFailedEvent | null>

Since: 7.22.0


setShakeMenu(...)

setShakeMenu(options: SetShakeMenuOptions) => Promise<void>

Enable or disable the shake gesture menu for debugging and testing.

When enabled, users can shake their device to open a debug menu that shows:

  • Current bundle information
  • Available bundles
  • Options to switch bundles manually
  • Update status

This is useful during development and testing to:

  • Quickly test different bundle versions
  • Debug update flows
  • Switch between production and test bundles
  • Verify bundle installations

Important: Disable this in production builds or only enable for internal testers.

Can also be configured via {@link PluginsConfig.CapacitorUpdater.shakeMenu}.

Param Type
options SetShakeMenuOptions

Since: 7.5.0


isShakeMenuEnabled()

isShakeMenuEnabled() => Promise<ShakeMenuEnabled>

Check if the shake gesture debug menu is currently enabled.

Returns the current state of the shake menu feature that can be toggled via {@link setShakeMenu} or configured via {@link PluginsConfig.CapacitorUpdater.shakeMenu}.

Use this to:

  • Check if debug features are enabled
  • Show/hide debug settings UI
  • Verify configuration during testing

Returns: Promise<ShakeMenuEnabled>

Since: 7.5.0


getAppId()

getAppId() => Promise<GetAppIdRes>

Get the currently configured App ID used for update server communication.

Returns the App ID that identifies this app to the update server. This can be:

  • The value set via {@link setAppId}, or
  • The {@link PluginsConfig.CapacitorUpdater.appId} config value, or
  • The default app identifier from your native app configuration

Use this to:

  • Verify which App ID is being used for updates
  • Debug update delivery issues
  • Display app configuration in debug screens
  • Confirm App ID after calling {@link setAppId}

Returns: Promise<GetAppIdRes>

Since: 7.14.0


setAppId(...)

setAppId(options: SetAppIdOptions) => Promise<void>

Dynamically change the App ID used for update server communication.

This overrides the App ID used to identify your app to the update server, allowing you to switch between different app configurations at runtime (e.g., production vs staging app IDs, or multi-tenant configurations).

Requirements:

  • {@link PluginsConfig.CapacitorUpdater.allowModifyAppId} must be set to true

Important considerations:

  • Changing the App ID will affect which updates this device receives
  • The new App ID must exist on your update server
  • This is primarily for advanced use cases (multi-tenancy, environment switching)
  • Most apps should use the config-based {@link PluginsConfig.CapacitorUpdater.appId} instead
Param Type
options SetAppIdOptions

Since: 7.14.0


Interfaces

AppReadyResult
Prop Type
bundle BundleInfo
BundleInfo
Prop Type
id string
version string
downloaded string
checksum string
status BundleStatus
UpdateUrl
Prop Type
url string
StatsUrl
Prop Type
url string
ChannelUrl
Prop Type
url string
DownloadOptions

This URL and versions are used to download the bundle from the server, If you use backend all information will be given by the method getLatest. If you don't use backend, you need to provide the URL and version of the bundle. Checksum and sessionKey are required if you encrypted the bundle with the CLI command encrypt, you should receive them as result of the command.

Prop Type Description Default Since
url string The URL of the bundle zip file (e.g: dist.zip) to be downloaded. (This can be any URL. E.g: Amazon S3, a GitHub tag, any other place you've hosted your bundle.)
version string The version code/name of this bundle/version
sessionKey string The session key for the update, when the bundle is encrypted with a session key undefined 4.0.0
checksum string The checksum for the update, it should be in sha256 and encrypted with private key if the bundle is encrypted undefined 4.0.0
manifest ManifestEntry[] The manifest for multi-file downloads undefined 6.1.0
ManifestEntry
Prop Type
file_name string | null
file_hash string | null
download_url string | null
BundleId
Prop Type
id string
BundleListResult
Prop Type
bundles BundleInfo[]
ListOptions
Prop Type Description Default Since
raw boolean Whether to return the raw bundle list or the manifest. If true, the list will attempt to read the internal database instead of files on disk. false 6.14.0
ResetOptions
Prop Type
toLastSuccessful boolean
CurrentBundleResult
Prop Type
bundle BundleInfo
native string
MultiDelayConditions
Prop Type
delayConditions DelayCondition[]
DelayCondition
Prop Type Description
kind DelayUntilNext Set up delay conditions in setMultiDelay
value string
LatestVersion
Prop Type Description Since
version string Result of getLatest method 4.0.0
checksum string 6
breaking boolean Indicates whether the update was flagged as breaking by the backend. 7.22.0
major boolean
message string
sessionKey string
error string
old string
url string
manifest ManifestEntry[] 6.1
GetLatestOptions
Prop Type Description Default Since
channel string The channel to get the latest version for The channel must allow 'self_assign' for this to work undefined 6.8.0
ChannelRes
Prop Type Description Since
status string Current status of set channel 4.7.0
error string
message string
SetChannelOptions
Prop Type
channel string
triggerAutoUpdate boolean
UnsetChannelOptions
Prop Type
triggerAutoUpdate boolean
GetChannelRes
Prop Type Description Since
channel string Current status of get channel 4.8.0
error string
message string
status string
allowSet boolean
ListChannelsResult
Prop Type Description Since
channels ChannelInfo[] List of available channels 7.5.0
ChannelInfo
Prop Type Description Since
id string The channel ID 7.5.0
name string The channel name 7.5.0
public boolean Whether this is a public channel 7.5.0
allow_self_set boolean Whether devices can self-assign to this channel 7.5.0
SetCustomIdOptions
Prop Type Description
customId string Custom identifier to associate with the device. Use an empty string to clear any saved value.
BuiltinVersion
Prop Type
version string
DeviceId
Prop Type
deviceId string
PluginVersion
Prop Type
version string
AutoUpdateEnabled
Prop Type
enabled boolean
PluginListenerHandle
Prop Type
remove () => Promise<void>
DownloadEvent
Prop Type Description Since
percent number Current status of download, between 0 and 100. 4.0.0
bundle BundleInfo
NoNeedEvent
Prop Type Description Since
bundle BundleInfo Current status of download, between 0 and 100. 4.0.0
UpdateAvailableEvent
Prop Type Description Since
bundle BundleInfo Current status of download, between 0 and 100. 4.0.0
DownloadCompleteEvent
Prop Type Description Since
bundle BundleInfo Emit when a new update is available. 4.0.0
MajorAvailableEvent
Prop Type Description Since
version string Emit when a breaking update is available. 4.0.0
UpdateFailedEvent
Prop Type Description Since
bundle BundleInfo Emit when a update failed to install. 4.0.0
DownloadFailedEvent
Prop Type Description Since
version string Emit when a download fail. 4.0.0
AppReadyEvent
Prop Type Description Since
bundle BundleInfo Emitted when the app is ready to use. 5.2.0
status string
AutoUpdateAvailable
Prop Type
available boolean
SetShakeMenuOptions
Prop Type
enabled boolean
ShakeMenuEnabled
Prop Type
enabled boolean
GetAppIdRes
Prop Type
appId string
SetAppIdOptions
Prop Type
appId string

Type Aliases

BundleStatus

pending: The bundle is pending to be SET as the next bundle. downloading: The bundle is being downloaded. success: The bundle has been downloaded and is ready to be SET as the next bundle. error: The bundle has failed to download.

'success' | 'error' | 'pending' | 'downloading'

DelayUntilNext

'background' | 'kill' | 'nativeVersion' | 'date'

BreakingAvailableEvent

Payload emitted by {@link CapacitorUpdaterPlugin.addListener} with breakingAvailable.

MajorAvailableEvent

Listen to download events

  import { CapacitorUpdater } from '@capgo/capacitor-updater';

CapacitorUpdater.addListener('download', (info: any) => {
  console.log('download was fired', info.percent);
});

On iOS, Apple don't allow you to show a message when the app is updated, so you can't show a progress bar.

Inspiration

Contributors

jamesyoung1337 Thank you so much for your guidance and support, it was impossible to make this plugin work without you.