# CodePush

**CodePush** is a cloud-based service that allows developers to deliver over-the-air (OTA) updates for mobile apps—without waiting for app store reviews or resubmissions. It enables you to push real-time updates such as:

* JavaScript files
* Images
* Other app assets

With CodePush integrated into your project via App Maker, you can instantly ship bug fixes, improvements, or UI tweaks to users across iOS, Android, and Huawei platforms.

CodePush updates are tightly linked to your app’s **builds**. Each CodePush version is associated with a successful build and a store version (e.g., 3.0.0).

When you publish a CodePush update:

* It **targets users who have that build installed**.
* The update is downloaded automatically when the app launches—depending on its mandatory setting.
* Devices will only receive CodePush updates if:
  * The associated build is **successful**.
  * The build **does not have Force Update applied**.

#### <mark style="color:red;">**Navigation:**</mark>

To access the CodePush section:

**Projects → Project Detail → Build Detail → Related CodePush**

{% hint style="info" %}
CodePush updates live on the same page as the build since they inherit configuration from the selected build.
{% endhint %}

<figure><img src="/files/cDMOWw25Es41J2eLlZ0L" alt=""><figcaption></figcaption></figure>

#### <mark style="color:red;">CodePush Deployment Rules:</mark>

* Each **build** can have **unlimited CodePush updates**.
* Every new successful CodePush **overrides** the previous one.
* The most recent successful update is considered **Live** and is used as the active version.

## <mark style="color:red;">CodePush Properties</mark>

The following properties define the configuration and behavior of each CodePush update:

<table><thead><tr><th width="137.13671875">Property</th><th>Description</th></tr></thead><tbody><tr><td><strong>Deployment ID</strong></td><td>A unique identifier for the CodePush update.</td></tr><tr><td><strong>Duration</strong></td><td>Total execution time of the deployment process.</td></tr><tr><td><strong>Mandatory</strong></td><td>To enable users to receive CodePush updates during the Splash Screen phase, mark this field as <strong>mandatory</strong>.<br>If left unchecked, the update will be downloaded when the user opens the app for the first time and will be installed on the second launch.</td></tr><tr><td><strong>Description</strong></td><td>Represents the notes or additional context added during the creation of the CodePush.</td></tr><tr><td><strong>Target Binary Range</strong></td><td>Refers to the store version associated with the build. This means the update will only be delivered to applications installed with this exact version.</td></tr><tr><td><strong>Label</strong></td><td>A version label is automatically added for every successful CodePush.<br>In a new build, labeling starts from <code>v1</code> and continues incrementally as <code>v2</code>, <code>v3</code>, and so on.</td></tr><tr><td><strong>Live</strong></td><td>The latest successful CodePush deployment is identified by the highest label number prefixed with "v" (e.g., <code>v3</code>). This label represents the most recent and active version of the deployment.</td></tr></tbody></table>

## <mark style="color:red;">Metrics</mark>

The following metrics are provided to help you track the process for published CodePush updates:

<table><thead><tr><th width="112.6484375">Metric</th><th>Description</th></tr></thead><tbody><tr><td><strong>Rollout</strong></td><td>Indicates the percentage of active users that the new update is intended to reach.<br><strong>Note:</strong> The default rollout value is set to <strong>100%.</strong></td></tr><tr><td><strong>Rollbacks</strong></td><td>Counts fallback events triggered when a device fails to apply a CodePush update. When a CodePush update fails during download or installation on a device, the previous version is automatically restored. Each such fallback event increments this value.</td></tr><tr><td><strong>Active</strong></td><td>Represents the percentage of users who have received the latest CodePush update, relative to the total user base.<br>For example, if the app has 100 users and the latest CodePush reached 50 of them, the active percentage is <strong>50%</strong>.</td></tr><tr><td><strong>Downloads</strong></td><td>Displays the total number of times the update has been downloaded by user devices.</td></tr><tr><td><strong>Installs</strong></td><td>Displays the total number of successful installations of the update across all devices.</td></tr></tbody></table>

## <mark style="color:red;">Creating a New CodePush</mark>

To create a new CodePush deployment:

1. Navigate to the build where the update should be applied.
2. Click the **`+CODEPUSH`** button to open the creation form.

<figure><img src="/files/XU9ulEunslBEbEo6zIg1" alt=""><figcaption></figcaption></figure>

{% hint style="warning" %}
**Important:**

* **Build Target** (e.g., Production, Staging) and **Platform** (iOS, Android, Huawei) fields are pre-filled and **cannot be changed**.
* These values must match the build’s configuration.
  {% endhint %}

## <mark style="color:red;">Updating an Existing CodePush</mark>

You can update a published CodePush for users who haven't received it yet:

* Click the **Edit** link on the bottom right of the CodePush card.
* Update the following as needed:
  * **Description**: Modify the release notes.
  * **Enabled**: Disable the update to revert to the previous live CodePush.

    > Let’s illustrate this with an example:\
    > Suppose you have released two CodePush updates labeled `v1` and `v2`. In this case, `v2` is the current **Live** update. Later, you publish a third update labeled `v3`, which begins rolling out and takes over the **Live** status from `v2`.\
    > If you then **disable** the `v3` update by turning off its **Enabled** setting, the system will automatically revert to the previous successful update—`v2`—and mark it as the new **Live** version.
  * **Mandatory**: Change whether the update is forced at Splash Screen or not.

<figure><img src="/files/1XMBZBerQEGcaViH2tro" alt="" width="563"><figcaption></figcaption></figure>

## <mark style="color:red;">Rollback a CodePush</mark>

The **Rollback** feature allows you to revert the latest **Live** CodePush update by promoting a previously published version as a new release. This is useful when the most recent deployment causes issues in production.

<div align="center"><figure><img src="/files/5uDFuXIRd2TtWCGaHK4B" alt="" width="279"><figcaption></figcaption></figure></div>

#### **Example Scenario**

Suppose you have the following CodePush history:

<table><thead><tr><th width="353.89453125">Label</th><th>Live</th></tr></thead><tbody><tr><td>v3</td><td>True</td></tr><tr><td>v2</td><td>False</td></tr><tr><td>v1</td><td>False</td></tr></tbody></table>

In this case, `v3` is currently the **Live** update.

To rollback from `v3` and promote `v2` as the new Live version:

1. Click the **Rollback** link at the bottom right of the `v3` CodePush.
2. In the modal that appears, select `v2` from the list of previous successful updates.
3. Confirm the rollback operation.

<figure><img src="/files/PIvhXy6raDhtL1fwPPTG" alt="" width="448"><figcaption></figcaption></figure>

{% hint style="info" %}
This action **does not restore `v2` directly** as the live version. Instead, a **new CodePush update** is created based on the contents of `v2` and published under a **new label**, such as `v4`.
{% endhint %}

After the rollback:

| Label                  | Live  |
| ---------------------- | ----- |
| v4 (references **v2**) | True  |
| v3                     | False |
| v2                     | False |
| v1                     | False |

`v3` is no longer active, and the rollback version (`v4`, based on `v2`) becomes the new **Live** update.

## Promote a CodePush

You can promote any previously successful (but non-live) CodePush by republishing it as a new update:

1. Click the **Promote** link on the bottom right of the desired CodePush.

   <div align="left"><figure><img src="/files/iw6Dbrm9z9cz0AawfIrP" alt="" width="315"><figcaption></figcaption></figure></div>
2. Confirm the action in the modal window.

   <div align="left"><figure><img src="/files/69cxRwjlKEPYVJSrB2h8" alt="" width="370"><figcaption></figcaption></figure></div>

Once confirmed, a new CodePush will be created with an incremented label (e.g., from `v2` → `v4`), and it will be considered the latest live update.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.akinon.com/tutorials/app-maker/projects/codepush.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
