@capgo/capacitor-updater 8.3.0 → 8.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +334 -2
- package/android/build.gradle +3 -0
- package/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdaterPlugin.java +348 -22
- package/dist/docs.json +607 -1
- package/dist/esm/definitions.d.ts +426 -0
- package/dist/esm/definitions.js +103 -1
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/history.js +2 -2
- package/dist/esm/history.js.map +1 -1
- package/dist/esm/web.d.ts +6 -1
- package/dist/esm/web.js +24 -0
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +134 -2
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +134 -2
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/CapacitorUpdaterPlugin/CapacitorUpdaterPlugin.swift +212 -2
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -68,6 +68,38 @@ Join the [discord](https://discord.gg/VnYRvBfgA6) to get help.
|
|
|
68
68
|
|
|
69
69
|
## Migration to v8
|
|
70
70
|
|
|
71
|
+
This major version is here to follow Capacitor major version 8
|
|
72
|
+
|
|
73
|
+
First follow the migration guide of Capacitor:
|
|
74
|
+
|
|
75
|
+
[https://capacitorjs.com/docs/updating/8-0](https://capacitorjs.com/docs/updating/8-0/)
|
|
76
|
+
|
|
77
|
+
### iOS Minimum Version Requirement
|
|
78
|
+
|
|
79
|
+
The iOS minimum deployment target has been bumped to **15.5** to ensure that iOS devices with [CVE-2022-36943](https://nvd.nist.gov/vuln/detail/CVE-2022-36943) are excluded. This is the minimum version of the iOS zip library that has the security fix implemented.
|
|
80
|
+
|
|
81
|
+
#### Swift Package Manager (SPM) Workaround
|
|
82
|
+
|
|
83
|
+
Capacitor currently has a bug ([ionic-team/capacitor#7556](https://github.com/ionic-team/capacitor/issues/7556)) that does not allow setting the iOS deployment target to 15.5 when using SPM.
|
|
84
|
+
|
|
85
|
+
If you need SPM support, you can temporarily use our fork:
|
|
86
|
+
|
|
87
|
+
**GitHub:** [https://github.com/Cap-go/capacitor-plus](https://github.com/Cap-go/capacitor-plus)
|
|
88
|
+
|
|
89
|
+
To use it, replace the CLI package `@capacitor/cli` with `@capacitor-plus/cli`:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
npm uninstall @capacitor/cli
|
|
93
|
+
npm install @capacitor-plus/cli
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Then use the CLI as usual:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
npx capacitor sync
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
|
|
71
103
|
## Migration to v7.34
|
|
72
104
|
|
|
73
105
|
- **Channel storage change**: `setChannel()` now stores channel assignments locally on the device instead of in the cloud. This provides better offline support and reduces backend load.
|
|
@@ -86,10 +118,10 @@ zlib is a native library so we need to bump the minimum iOS version to 15.5 as Z
|
|
|
86
118
|
|
|
87
119
|
| Plugin version | Capacitor compatibility | Maintained |
|
|
88
120
|
| -------------- | ----------------------- | ----------------- |
|
|
89
|
-
| v8.\*.\* | v8.\*.\* |
|
|
121
|
+
| v8.\*.\* | v8.\*.\* | ✅ |
|
|
90
122
|
| v7.\*.\* | v7.\*.\* | ✅ |
|
|
91
123
|
| v6.\*.\* | v6.\*.\* | ✅ |
|
|
92
|
-
| v5.\*.\* | v5.\*.\* |
|
|
124
|
+
| v5.\*.\* | v5.\*.\* | ✅ |
|
|
93
125
|
| v4.\*.\* | v4.\*.\* | ⚠️ Deprecated |
|
|
94
126
|
| v3.\*.\* | v3.\*.\* | ⚠️ Deprecated |
|
|
95
127
|
| > 7 | v4.\*.\* | ⚠️ Deprecated, our CI got crazy and bumped too much version |
|
|
@@ -432,6 +464,7 @@ export default config;
|
|
|
432
464
|
* [`addListener('appReloaded', ...)`](#addlistenerappreloaded-)
|
|
433
465
|
* [`addListener('appReady', ...)`](#addlistenerappready-)
|
|
434
466
|
* [`addListener('channelPrivate', ...)`](#addlistenerchannelprivate-)
|
|
467
|
+
* [`addListener('onFlexibleUpdateStateChange', ...)`](#addlisteneronflexibleupdatestatechange-)
|
|
435
468
|
* [`isAutoUpdateAvailable()`](#isautoupdateavailable)
|
|
436
469
|
* [`getNextBundle()`](#getnextbundle)
|
|
437
470
|
* [`getFailedUpdate()`](#getfailedupdate)
|
|
@@ -439,8 +472,14 @@ export default config;
|
|
|
439
472
|
* [`isShakeMenuEnabled()`](#isshakemenuenabled)
|
|
440
473
|
* [`getAppId()`](#getappid)
|
|
441
474
|
* [`setAppId(...)`](#setappid)
|
|
475
|
+
* [`getAppUpdateInfo(...)`](#getappupdateinfo)
|
|
476
|
+
* [`openAppStore(...)`](#openappstore)
|
|
477
|
+
* [`performImmediateUpdate()`](#performimmediateupdate)
|
|
478
|
+
* [`startFlexibleUpdate()`](#startflexibleupdate)
|
|
479
|
+
* [`completeFlexibleUpdate()`](#completeflexibleupdate)
|
|
442
480
|
* [Interfaces](#interfaces)
|
|
443
481
|
* [Type Aliases](#type-aliases)
|
|
482
|
+
* [Enums](#enums)
|
|
444
483
|
|
|
445
484
|
</docgen-index>
|
|
446
485
|
|
|
@@ -1444,6 +1483,43 @@ This event is useful for:
|
|
|
1444
1483
|
--------------------
|
|
1445
1484
|
|
|
1446
1485
|
|
|
1486
|
+
#### addListener('onFlexibleUpdateStateChange', ...)
|
|
1487
|
+
|
|
1488
|
+
```typescript
|
|
1489
|
+
addListener(eventName: 'onFlexibleUpdateStateChange', listenerFunc: (state: FlexibleUpdateState) => void) => Promise<PluginListenerHandle>
|
|
1490
|
+
```
|
|
1491
|
+
|
|
1492
|
+
Listen for flexible update state changes on Android.
|
|
1493
|
+
|
|
1494
|
+
This event fires during the flexible update download process, providing:
|
|
1495
|
+
- Download progress (bytes downloaded / total bytes)
|
|
1496
|
+
- Installation status changes
|
|
1497
|
+
|
|
1498
|
+
**Install status values:**
|
|
1499
|
+
- `UNKNOWN` (0): Unknown status
|
|
1500
|
+
- `PENDING` (1): Download pending
|
|
1501
|
+
- `DOWNLOADING` (2): Download in progress
|
|
1502
|
+
- `INSTALLING` (3): Installing the update
|
|
1503
|
+
- `INSTALLED` (4): Update installed (app restart needed)
|
|
1504
|
+
- `FAILED` (5): Update failed
|
|
1505
|
+
- `CANCELED` (6): Update was canceled
|
|
1506
|
+
- `DOWNLOADED` (11): Download complete, ready to install
|
|
1507
|
+
|
|
1508
|
+
When status is `DOWNLOADED`, you should prompt the user and call
|
|
1509
|
+
{@link completeFlexibleUpdate} to finish the installation.
|
|
1510
|
+
|
|
1511
|
+
| Param | Type |
|
|
1512
|
+
| ------------------ | --------------------------------------------------------------------------------------- |
|
|
1513
|
+
| **`eventName`** | <code>'onFlexibleUpdateStateChange'</code> |
|
|
1514
|
+
| **`listenerFunc`** | <code>(state: <a href="#flexibleupdatestate">FlexibleUpdateState</a>) => void</code> |
|
|
1515
|
+
|
|
1516
|
+
**Returns:** <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>></code>
|
|
1517
|
+
|
|
1518
|
+
**Since:** 8.0.0
|
|
1519
|
+
|
|
1520
|
+
--------------------
|
|
1521
|
+
|
|
1522
|
+
|
|
1447
1523
|
#### isAutoUpdateAvailable()
|
|
1448
1524
|
|
|
1449
1525
|
```typescript
|
|
@@ -1642,6 +1718,164 @@ app IDs, or multi-tenant configurations).
|
|
|
1642
1718
|
--------------------
|
|
1643
1719
|
|
|
1644
1720
|
|
|
1721
|
+
#### getAppUpdateInfo(...)
|
|
1722
|
+
|
|
1723
|
+
```typescript
|
|
1724
|
+
getAppUpdateInfo(options?: GetAppUpdateInfoOptions | undefined) => Promise<AppUpdateInfo>
|
|
1725
|
+
```
|
|
1726
|
+
|
|
1727
|
+
Get information about the app's availability in the App Store or Play Store.
|
|
1728
|
+
|
|
1729
|
+
This method checks the native app stores to see if a newer version of the app
|
|
1730
|
+
is available for download. This is different from Capgo's OTA updates - this
|
|
1731
|
+
checks for native app updates that require going through the app stores.
|
|
1732
|
+
|
|
1733
|
+
**Platform differences:**
|
|
1734
|
+
- **Android**: Uses Play Store's In-App Updates API for accurate update information
|
|
1735
|
+
- **iOS**: Queries the App Store lookup API (requires country code for accurate results)
|
|
1736
|
+
|
|
1737
|
+
**Returns information about:**
|
|
1738
|
+
- Current installed version
|
|
1739
|
+
- Available version in the store (if any)
|
|
1740
|
+
- Whether an update is available
|
|
1741
|
+
- Update priority (Android only)
|
|
1742
|
+
- Whether immediate/flexible updates are allowed (Android only)
|
|
1743
|
+
|
|
1744
|
+
Use this to:
|
|
1745
|
+
- Check if users need to update from the app store
|
|
1746
|
+
- Show "Update Available" prompts for native updates
|
|
1747
|
+
- Implement version gating (require minimum native version)
|
|
1748
|
+
- Combine with Capgo OTA updates for a complete update strategy
|
|
1749
|
+
|
|
1750
|
+
| Param | Type | Description |
|
|
1751
|
+
| ------------- | --------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
|
|
1752
|
+
| **`options`** | <code><a href="#getappupdateinfooptions">GetAppUpdateInfoOptions</a></code> | Optional {@link <a href="#getappupdateinfooptions">GetAppUpdateInfoOptions</a>} with country code for iOS. |
|
|
1753
|
+
|
|
1754
|
+
**Returns:** <code>Promise<<a href="#appupdateinfo">AppUpdateInfo</a>></code>
|
|
1755
|
+
|
|
1756
|
+
**Since:** 8.0.0
|
|
1757
|
+
|
|
1758
|
+
--------------------
|
|
1759
|
+
|
|
1760
|
+
|
|
1761
|
+
#### openAppStore(...)
|
|
1762
|
+
|
|
1763
|
+
```typescript
|
|
1764
|
+
openAppStore(options?: OpenAppStoreOptions | undefined) => Promise<void>
|
|
1765
|
+
```
|
|
1766
|
+
|
|
1767
|
+
Open the app's page in the App Store or Play Store.
|
|
1768
|
+
|
|
1769
|
+
This navigates the user to your app's store listing where they can manually
|
|
1770
|
+
update the app. Use this as a fallback when in-app updates are not available
|
|
1771
|
+
or when the user needs to update on iOS.
|
|
1772
|
+
|
|
1773
|
+
**Platform behavior:**
|
|
1774
|
+
- **Android**: Opens Play Store to the app's page
|
|
1775
|
+
- **iOS**: Opens App Store to the app's page
|
|
1776
|
+
|
|
1777
|
+
**Customization options:**
|
|
1778
|
+
- `appId`: Specify a custom App Store ID (iOS) - useful for opening a different app's page
|
|
1779
|
+
- `packageName`: Specify a custom package name (Android) - useful for opening a different app's page
|
|
1780
|
+
|
|
1781
|
+
| Param | Type | Description |
|
|
1782
|
+
| ------------- | ------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- |
|
|
1783
|
+
| **`options`** | <code><a href="#openappstoreoptions">OpenAppStoreOptions</a></code> | Optional {@link <a href="#openappstoreoptions">OpenAppStoreOptions</a>} to customize which app's store page to open. |
|
|
1784
|
+
|
|
1785
|
+
**Since:** 8.0.0
|
|
1786
|
+
|
|
1787
|
+
--------------------
|
|
1788
|
+
|
|
1789
|
+
|
|
1790
|
+
#### performImmediateUpdate()
|
|
1791
|
+
|
|
1792
|
+
```typescript
|
|
1793
|
+
performImmediateUpdate() => Promise<AppUpdateResult>
|
|
1794
|
+
```
|
|
1795
|
+
|
|
1796
|
+
Perform an immediate in-app update on Android.
|
|
1797
|
+
|
|
1798
|
+
This triggers Google Play's immediate update flow, which:
|
|
1799
|
+
1. Shows a full-screen update UI
|
|
1800
|
+
2. Downloads and installs the update
|
|
1801
|
+
3. Restarts the app automatically
|
|
1802
|
+
|
|
1803
|
+
The user cannot continue using the app until the update is complete.
|
|
1804
|
+
This is ideal for critical updates that must be installed immediately.
|
|
1805
|
+
|
|
1806
|
+
**Requirements:**
|
|
1807
|
+
- Android only (throws error on iOS)
|
|
1808
|
+
- An update must be available (check with {@link getAppUpdateInfo} first)
|
|
1809
|
+
- The update must allow immediate updates (`immediateUpdateAllowed: true`)
|
|
1810
|
+
|
|
1811
|
+
**User experience:**
|
|
1812
|
+
- Full-screen blocking UI
|
|
1813
|
+
- Progress shown during download
|
|
1814
|
+
- App automatically restarts after installation
|
|
1815
|
+
|
|
1816
|
+
**Returns:** <code>Promise<<a href="#appupdateresult">AppUpdateResult</a>></code>
|
|
1817
|
+
|
|
1818
|
+
**Since:** 8.0.0
|
|
1819
|
+
|
|
1820
|
+
--------------------
|
|
1821
|
+
|
|
1822
|
+
|
|
1823
|
+
#### startFlexibleUpdate()
|
|
1824
|
+
|
|
1825
|
+
```typescript
|
|
1826
|
+
startFlexibleUpdate() => Promise<AppUpdateResult>
|
|
1827
|
+
```
|
|
1828
|
+
|
|
1829
|
+
Start a flexible in-app update on Android.
|
|
1830
|
+
|
|
1831
|
+
This triggers Google Play's flexible update flow, which:
|
|
1832
|
+
1. Downloads the update in the background
|
|
1833
|
+
2. Allows the user to continue using the app
|
|
1834
|
+
3. Notifies when download is complete
|
|
1835
|
+
4. Requires calling {@link completeFlexibleUpdate} to install
|
|
1836
|
+
|
|
1837
|
+
Monitor the download progress using the `onFlexibleUpdateStateChange` listener.
|
|
1838
|
+
|
|
1839
|
+
**Requirements:**
|
|
1840
|
+
- Android only (throws error on iOS)
|
|
1841
|
+
- An update must be available (check with {@link getAppUpdateInfo} first)
|
|
1842
|
+
- The update must allow flexible updates (`flexibleUpdateAllowed: true`)
|
|
1843
|
+
|
|
1844
|
+
**Typical flow:**
|
|
1845
|
+
1. Call `startFlexibleUpdate()` to begin download
|
|
1846
|
+
2. Listen to `onFlexibleUpdateStateChange` for progress
|
|
1847
|
+
3. When status is `DOWNLOADED`, prompt user to restart
|
|
1848
|
+
4. Call `completeFlexibleUpdate()` to install and restart
|
|
1849
|
+
|
|
1850
|
+
**Returns:** <code>Promise<<a href="#appupdateresult">AppUpdateResult</a>></code>
|
|
1851
|
+
|
|
1852
|
+
**Since:** 8.0.0
|
|
1853
|
+
|
|
1854
|
+
--------------------
|
|
1855
|
+
|
|
1856
|
+
|
|
1857
|
+
#### completeFlexibleUpdate()
|
|
1858
|
+
|
|
1859
|
+
```typescript
|
|
1860
|
+
completeFlexibleUpdate() => Promise<void>
|
|
1861
|
+
```
|
|
1862
|
+
|
|
1863
|
+
Complete a flexible in-app update on Android.
|
|
1864
|
+
|
|
1865
|
+
After a flexible update has been downloaded (status `DOWNLOADED` in
|
|
1866
|
+
`onFlexibleUpdateStateChange`), call this method to install the update
|
|
1867
|
+
and restart the app.
|
|
1868
|
+
|
|
1869
|
+
**Important:** This will immediately restart the app. Make sure to:
|
|
1870
|
+
- Save any user data before calling
|
|
1871
|
+
- Prompt the user before restarting
|
|
1872
|
+
- Only call when the download status is `DOWNLOADED`
|
|
1873
|
+
|
|
1874
|
+
**Since:** 8.0.0
|
|
1875
|
+
|
|
1876
|
+
--------------------
|
|
1877
|
+
|
|
1878
|
+
|
|
1645
1879
|
#### Interfaces
|
|
1646
1880
|
|
|
1647
1881
|
|
|
@@ -1943,6 +2177,17 @@ If you don't use backend, you need to provide the URL and version of the bundle.
|
|
|
1943
2177
|
| **`message`** | <code>string</code> | | |
|
|
1944
2178
|
|
|
1945
2179
|
|
|
2180
|
+
##### FlexibleUpdateState
|
|
2181
|
+
|
|
2182
|
+
State information for flexible update progress (Android only).
|
|
2183
|
+
|
|
2184
|
+
| Prop | Type | Description | Since |
|
|
2185
|
+
| -------------------------- | ----------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ----- |
|
|
2186
|
+
| **`installStatus`** | <code><a href="#flexibleupdateinstallstatus">FlexibleUpdateInstallStatus</a></code> | The current installation status. | 8.0.0 |
|
|
2187
|
+
| **`bytesDownloaded`** | <code>number</code> | Number of bytes downloaded so far. Only available during the `DOWNLOADING` status. | 8.0.0 |
|
|
2188
|
+
| **`totalBytesToDownload`** | <code>number</code> | Total number of bytes to download. Only available during the `DOWNLOADING` status. | 8.0.0 |
|
|
2189
|
+
|
|
2190
|
+
|
|
1946
2191
|
##### AutoUpdateAvailable
|
|
1947
2192
|
|
|
1948
2193
|
| Prop | Type |
|
|
@@ -1978,6 +2223,54 @@ If you don't use backend, you need to provide the URL and version of the bundle.
|
|
|
1978
2223
|
| **`appId`** | <code>string</code> |
|
|
1979
2224
|
|
|
1980
2225
|
|
|
2226
|
+
##### AppUpdateInfo
|
|
2227
|
+
|
|
2228
|
+
Information about app updates available in the App Store or Play Store.
|
|
2229
|
+
|
|
2230
|
+
| Prop | Type | Description | Since |
|
|
2231
|
+
| --------------------------------- | ----------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----- |
|
|
2232
|
+
| **`currentVersionName`** | <code>string</code> | The currently installed version name (e.g., "1.2.3"). | 8.0.0 |
|
|
2233
|
+
| **`availableVersionName`** | <code>string</code> | The version name available in the store, if an update is available. May be undefined if no update information is available. | 8.0.0 |
|
|
2234
|
+
| **`currentVersionCode`** | <code>string</code> | The currently installed version code (Android) or build number (iOS). | 8.0.0 |
|
|
2235
|
+
| **`availableVersionCode`** | <code>string</code> | The version code available in the store (Android only). On iOS, this will be the same as `availableVersionName`. | 8.0.0 |
|
|
2236
|
+
| **`availableVersionReleaseDate`** | <code>string</code> | The release date of the available version (iOS only). Format: ISO 8601 date string. | 8.0.0 |
|
|
2237
|
+
| **`updateAvailability`** | <code><a href="#appupdateavailability">AppUpdateAvailability</a></code> | The current update availability status. | 8.0.0 |
|
|
2238
|
+
| **`updatePriority`** | <code>number</code> | The priority of the update as set by the developer in Play Console (Android only). Values range from 0 (default/lowest) to 5 (highest priority). Use this to decide whether to show an update prompt or force an update. | 8.0.0 |
|
|
2239
|
+
| **`immediateUpdateAllowed`** | <code>boolean</code> | Whether an immediate update is allowed (Android only). If `true`, you can call {@link CapacitorUpdaterPlugin.performImmediateUpdate}. | 8.0.0 |
|
|
2240
|
+
| **`flexibleUpdateAllowed`** | <code>boolean</code> | Whether a flexible update is allowed (Android only). If `true`, you can call {@link CapacitorUpdaterPlugin.startFlexibleUpdate}. | 8.0.0 |
|
|
2241
|
+
| **`clientVersionStalenessDays`** | <code>number</code> | Number of days since the update became available (Android only). Use this to implement "update nagging" - remind users more frequently as the update ages. | 8.0.0 |
|
|
2242
|
+
| **`installStatus`** | <code><a href="#flexibleupdateinstallstatus">FlexibleUpdateInstallStatus</a></code> | The current install status of a flexible update (Android only). | 8.0.0 |
|
|
2243
|
+
| **`minimumOsVersion`** | <code>string</code> | The minimum OS version required for the available update (iOS only). | 8.0.0 |
|
|
2244
|
+
|
|
2245
|
+
|
|
2246
|
+
##### GetAppUpdateInfoOptions
|
|
2247
|
+
|
|
2248
|
+
Options for {@link CapacitorUpdaterPlugin.getAppUpdateInfo}.
|
|
2249
|
+
|
|
2250
|
+
| Prop | Type | Description | Since |
|
|
2251
|
+
| ------------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
|
|
2252
|
+
| **`country`** | <code>string</code> | Two-letter country code (ISO 3166-1 alpha-2) for the App Store lookup. This is required on iOS to get accurate App Store information, as app availability and versions can vary by country. Examples: "US", "GB", "DE", "JP", "FR" On Android, this option is ignored as the Play Store handles region detection automatically. | 8.0.0 |
|
|
2253
|
+
|
|
2254
|
+
|
|
2255
|
+
##### OpenAppStoreOptions
|
|
2256
|
+
|
|
2257
|
+
Options for {@link CapacitorUpdaterPlugin.openAppStore}.
|
|
2258
|
+
|
|
2259
|
+
| Prop | Type | Description | Since |
|
|
2260
|
+
| ----------------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----- |
|
|
2261
|
+
| **`packageName`** | <code>string</code> | The Android package name to open in the Play Store. If not specified, uses the current app's package name. Use this to open a different app's store page. Only used on Android. | 8.0.0 |
|
|
2262
|
+
| **`appId`** | <code>string</code> | The iOS App Store ID to open. If not specified, uses the current app's bundle identifier to look up the app. Use this to open a different app's store page or when automatic lookup fails. Only used on iOS. | 8.0.0 |
|
|
2263
|
+
|
|
2264
|
+
|
|
2265
|
+
##### AppUpdateResult
|
|
2266
|
+
|
|
2267
|
+
Result of an app update operation.
|
|
2268
|
+
|
|
2269
|
+
| Prop | Type | Description | Since |
|
|
2270
|
+
| ---------- | ------------------------------------------------------------------- | ---------------------------------------- | ----- |
|
|
2271
|
+
| **`code`** | <code><a href="#appupdateresultcode">AppUpdateResultCode</a></code> | The result code of the update operation. | 8.0.0 |
|
|
2272
|
+
|
|
2273
|
+
|
|
1981
2274
|
#### Type Aliases
|
|
1982
2275
|
|
|
1983
2276
|
|
|
@@ -2002,6 +2295,45 @@ Payload emitted by {@link CapacitorUpdaterPlugin.addListener} with `breakingAvai
|
|
|
2002
2295
|
|
|
2003
2296
|
<code><a href="#majoravailableevent">MajorAvailableEvent</a></code>
|
|
2004
2297
|
|
|
2298
|
+
|
|
2299
|
+
#### Enums
|
|
2300
|
+
|
|
2301
|
+
|
|
2302
|
+
##### FlexibleUpdateInstallStatus
|
|
2303
|
+
|
|
2304
|
+
| Members | Value | Description |
|
|
2305
|
+
| ----------------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------ |
|
|
2306
|
+
| **`UNKNOWN`** | <code>0</code> | Unknown install status. |
|
|
2307
|
+
| **`PENDING`** | <code>1</code> | Download is pending and will start soon. |
|
|
2308
|
+
| **`DOWNLOADING`** | <code>2</code> | Download is in progress. Check `bytesDownloaded` and `totalBytesToDownload` for progress. |
|
|
2309
|
+
| **`INSTALLING`** | <code>3</code> | The update is being installed. |
|
|
2310
|
+
| **`INSTALLED`** | <code>4</code> | The update has been installed. The app needs to be restarted to use the new version. |
|
|
2311
|
+
| **`FAILED`** | <code>5</code> | The update failed to download or install. |
|
|
2312
|
+
| **`CANCELED`** | <code>6</code> | The update was canceled by the user. |
|
|
2313
|
+
| **`DOWNLOADED`** | <code>11</code> | The update has been downloaded and is ready to install. Call {@link CapacitorUpdaterPlugin.completeFlexibleUpdate} to install. |
|
|
2314
|
+
|
|
2315
|
+
|
|
2316
|
+
##### AppUpdateAvailability
|
|
2317
|
+
|
|
2318
|
+
| Members | Value | Description |
|
|
2319
|
+
| -------------------------- | -------------- | ------------------------------------------------------------------------------------------ |
|
|
2320
|
+
| **`UNKNOWN`** | <code>0</code> | Update availability is unknown. This typically means the check hasn't completed or failed. |
|
|
2321
|
+
| **`UPDATE_NOT_AVAILABLE`** | <code>1</code> | No update is available. The installed version is the latest. |
|
|
2322
|
+
| **`UPDATE_AVAILABLE`** | <code>2</code> | An update is available for download. |
|
|
2323
|
+
| **`UPDATE_IN_PROGRESS`** | <code>3</code> | An update is currently being downloaded or installed. |
|
|
2324
|
+
|
|
2325
|
+
|
|
2326
|
+
##### AppUpdateResultCode
|
|
2327
|
+
|
|
2328
|
+
| Members | Value | Description |
|
|
2329
|
+
| ------------------- | -------------- | --------------------------------------------------------------------------------------------------------------------------- |
|
|
2330
|
+
| **`OK`** | <code>0</code> | The update completed successfully. |
|
|
2331
|
+
| **`CANCELED`** | <code>1</code> | The user canceled the update. |
|
|
2332
|
+
| **`FAILED`** | <code>2</code> | The update failed. |
|
|
2333
|
+
| **`NOT_AVAILABLE`** | <code>3</code> | No update is available. |
|
|
2334
|
+
| **`NOT_ALLOWED`** | <code>4</code> | The requested update type is not allowed. For example, trying to perform an immediate update when only flexible is allowed. |
|
|
2335
|
+
| **`INFO_MISSING`** | <code>5</code> | Required information is missing. This can happen if {@link CapacitorUpdaterPlugin.getAppUpdateInfo} wasn't called first. |
|
|
2336
|
+
|
|
2005
2337
|
</docgen-api>
|
|
2006
2338
|
|
|
2007
2339
|
### Listen to download events
|
package/android/build.gradle
CHANGED
|
@@ -57,6 +57,9 @@ dependencies {
|
|
|
57
57
|
implementation project(':capacitor-android')
|
|
58
58
|
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
|
|
59
59
|
implementation 'io.github.g00fy2:versioncompare:1.5.0'
|
|
60
|
+
// Play Core library for in-app updates
|
|
61
|
+
implementation 'com.google.android.play:app-update:2.1.0'
|
|
62
|
+
implementation 'com.google.android.play:app-update-ktx:2.1.0'
|
|
60
63
|
testImplementation "junit:junit:$junitVersion"
|
|
61
64
|
testImplementation 'org.mockito:mockito-core:5.20.0'
|
|
62
65
|
testImplementation 'org.json:json:20250517'
|