HotUpdater.updateBundle()
The updateBundle
function downloads and applies a new update bundle to your React Native application. It uses the provided bundle information obtained from checkForUpdate
.
This method is particularly useful when you need a custom update strategy without using the built-in wrap
method.
Use updateBundle
to download and apply an available update by providing the bundle's unique identifier and the URL to the bundle file.
getUpdateSource
The getUpdateSource
function is used to construct the final URL for checking for updates. It takes a baseUrl
as its first argument and an options object as its second argument. The updateStrategy
property within the options object determines the final structure of the request URL.
Example Final Endpoint Structures:
Depending on the updateStrategy
value, getUpdateSource
generates URLs like the following:
updateStrategy: 'appVersion'
: GET {baseUrl}/app-version/:platform/:appVersion/:channel/:minBundleId/:bundleId
updateStrategy: 'fingerprint'
: GET {baseUrl}/fingerprint/:platform/:fingerprintHash/:channel/:minBundleId/:bundleId
For example, if you provide https://your-update-server.com/api/update-check
as the baseUrl
, getUpdateSource
will append the correct path and parameters to the URL depending on whether updateStrategy
is 'appVersion'
or 'fingerprint'
.
The updateBundle
function accepts the following parameters:
Parameter | Type | Required | Description |
---|---|---|---|
id | string | ✅ | Unique identifier of the update bundle. |
fileUrl | string | ✅ | URL from which the update bundle will be downloaded. |
fileUrl
.HotUpdater.reload()
if you want to immediately reload the application after updating, particularly when shouldForceUpdate
is true.