---
title: How to restrict Capacitor Live Updates to Native Versions
description: Learn how to restrict Capacitor Live Updates to specific native versions using versioned builds or channels to ensure compatibility and prevent issues.
date: 
  created: 2024-05-06
  updated: 2026-01-23
authors:
  - robingenz
categories:
  - Capacitor
  - Cloud
  - Guides
  - SDKs
links:
  - Capacitor Live Update: sdks/capacitor/live-update.md
---

# How to restrict Capacitor Live Updates to Native Versions

[Live Updates](../../cloud/live-updates/index.md) are a powerful feature that allows you to deliver updates to your Capacitor app in real-time without having to resubmit your app to the app stores.
However, it is important to make sure that only [Binary Compatible Changes](../../cloud/live-updates/faq.md#what-are-binary-compatible-changes) are delivered to your users to prevent incompatible updates.
In this guide, you will learn how to restrict live updates to specific native versions.

<!-- more -->

???+ warning "Deprecated"

    This guide is deprecated. Please refer to the [Best Practices](../../cloud/live-updates/index.md) guide for the latest information.

## Introduction

The [Capawesome Cloud](../../cloud/index.md) offers two different ways to restrict live updates to specific native versions:

1. [Versioned Bundles](#versioned-bundles)
2. [Versioned Channels](#versioned-channels)

Let's take a closer look at both options.

## Versioned Bundles

Versioned bundles allow you to restrict live updates to specific native versions by defining a range of version codes for each platform.

???+ info "Version Code"

    The version code (named [`versionCode`](https://developer.android.com/studio/publish/versioning){:target="_blank"} on Android and [`CFBundleVersion`](https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleversion){:target="_blank"} on iOS) is the internal version number of your app. It is used to determine whether one version is more recent than another and must be incremented each time you release a new version of your app.

To create a versioned build, you only need to specify the minimum and maximum version codes for each platform:

- **Minimum**: The native binary must have at least this version code to be compatible with the bundle.
- **Maximum**: The native binary must have at most this version code to be compatible with the bundle.
- **Equivalent**: If the native binary has this exact version code, do **NOT** download the bundle, because they are equal.

For this, you can use the following [Capawesome CLI](../../cloud/cli/index.md) command:

```bash
npx @capawesome/cli apps:liveupdates:upload --android-min 10 --android-max 12 --android-eq 11 --ios-min 10 --ios-max 12 --ios-eq 11
```

## Versioned Channels

Versioned channels allow you to restrict live updates to specific native versions by defining a channel for each version code.

???+ info "Channel"

    A Channel allows you to distribute different versions of your app to different groups of users.

To create a versioned channel, you can use the following [Capawesome CLI](../../cloud/cli/index.md) command:

```bash
npx @capawesome/cli apps:channels:create --name production-10
```

In this example, we created a channel named `production-10` for the version code `10`.

To upload a bundle to a specific channel, you can use the following [Capawesome CLI](../../cloud/cli/index.md) command:

```bash
npx @capawesome/cli apps:liveupdates:upload --channel production-10
```

Finally, we need to set the correct channel in the app to ensure that only compatible bundles are downloaded:

```ts
import { LiveUpdate } from '@capawesome/capacitor-live-update';

const sync = async () => {
  // Get the version code of the native app
  const { versionCode } = await LiveUpdate.getVersionCode();
  // Select the channel based on the version code
  await LiveUpdate.setChannel({ channel: `production-${versionCode}` }); 
  // Automatically download and set the latest compatible bundle
  await LiveUpdate.sync();
};
```

<!-- 
- Automate everything using CI/CD (you just need to manually increment the versionCode as soon as you make native changes)
-->

## Related Posts

- [Announcing the Live Update Plugin for Capacitor](./announcing-the-capacitor-live-update-plugin.md)
- [Capacitor App Updates: The Complete Guide](./capacitor-app-update-guide.md)
- [Capacitor Live Updates: The Complete OTA Guide](./capacitor-live-updates-guide.md)

## Conclusion

By following the steps in this guide, you can ensure that only compatible updates are delivered to your users and prevent any issues caused by incompatible changes.
While [Versioned Bundles](#versioned-bundles) seems to be the more straightforward approach, [Versioned Channels](#versioned-channels) are the recommended way to restrict live updates to specific native versions because they are easier to manage and therefore less error-prone.

If you have any questions, just [create a discussion](https://github.com/capawesome-team/capacitor-plugins/discussions/new/choose){:target="_blank"} in the GitHub repository. Make sure you follow [Capawesome](https://twitter.com/capawesomeio){:target="_blank"} on X so you don't miss any future updates.
