# Force Update

In some cases, it is essential to ensure users update their applications directly through the app store instead of relying on over-the-air (OTA) updates via CodePush. This is particularly important when native-level changes are introduced that **cannot be handled by CodePush**.

## <mark style="color:red;">When to Use Force Update</mark>

CodePush is limited to delivering updates to JavaScript files, images, and other assets. It **does not support** updates involving changes at the **native layer**—for example:

* Updates that include **native dependencies** or **plugins**.
* Changes made to native iOS or Android modules.
* Modifications to platform-specific configuration files.

In such scenarios, a **store update is mandatory**, and CodePush updates will not be delivered to affected users. To guide users to the app store for these updates, the **Force Update** mechanism can be applied.

To ensure users receive updates to your app through the store, you may want to guide them in that direction. CodePush has certain limitations. Specifically, when there are changes at the native layer or when a plugin working with the native layer is added, users must update their apps from the store. Updates of this kind sent through CodePush will not be received by users.

## <mark style="color:red;">Eligible Builds for Force Update</mark>

Not all builds can be force-updated. The following rules apply:

* ✅ **Eligible**: Builds that were previously marked as **Live** and have since been **replaced** by newer Live builds.
* ❌ **Not Eligible**: Builds that have never been marked as Live, even if they were successful.
* ❌ **Not Allowed**: You cannot apply Force Update to the **current Live build**.

## <mark style="color:red;">How to Apply a Force Update</mark>

To apply a Force Update to an older build:

1. Navigate to: **Projects → Project Detail → Build Detail**
2. Locate a previously Approved (but now inactive) build.
3. Click the **Force Update** link available in the build's detail view.
4. Confirm the action in the prompt that appears.

<div align="left"><figure><img src="/files/fDj2U6asB7m07MifeAZa" alt="" width="375"><figcaption></figcaption></figure></div>

Once confirmed:

* A new **CodePush process** will be triggered.
* If the operation is successful, the update will be marked and delivered as a **Force Update**.
* Users still running the targeted old build will receive a mandatory update prompt directing them to the store.

{% hint style="danger" %}
This operation is **irreversible**. Ensure you apply Force Update only when it is absolutely required.
{% endhint %}

## <mark style="color:red;">User Interface Behavior</mark>

When a user opens a deprecated version of the app, they see a non-dismissible modal prompting them to update. This modal contains a button that redirects directly to the app store.

While the app's home screen technically renders in the background, the modal obscures it, preventing any user interaction until the update is performed.

### <mark style="color:red;">Configuring iOS Store Redirection</mark>

You can configure how iOS users are redirected to the Apple App Store using one of two methods.

### Define the Store ID (Recommended)

This method ensures instant redirection without api calls. Add the **storeId** property to the **ios** object in your **akinon.json** file.

To find your Store ID:

1. Log in to [App Store Connect](https://appstoreconnect.apple.com/).
2. Select your app from the list.
3. Navigate to **App Information**.
4. Under the **General Information** section, locate the **Apple ID**.
5. Copy this numeric value and paste it into the **storeId** field in **akinon.json**.

<div align="left"><figure><img src="/files/KvLp6xD4gHePrZ2y5zBj" alt="" width="375"><figcaption></figcaption></figure></div>

### Redirection via iTunes API

If you do not add a **storeId** to **akinon.json**, the app attempts to retrieve it dynamically by querying the Apple iTunes API using your bundle identifier.

{% hint style="danger" %}
This method relies on an external API request. It introduces a waiting period while the app fetches the data. If the iTunes API is unreachable, the redirection mechanism will fail, and the user will not be taken to the Apple App Store.
{% endhint %}

*Example screen:*

<div align="left"><figure><img src="/files/kSbaMJc641NfMWgcTFsY" alt="" width="375"><figcaption></figcaption></figure></div>


---

# 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/force-update.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.
