@capgo/capacitor-updater 9.0.0 → 9.0.2

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.
Files changed (109) hide show
  1. package/CapgoCapacitorUpdater.podspec +3 -6
  2. package/Package.swift +30 -0
  3. package/README.md +2406 -291
  4. package/android/build.gradle +37 -17
  5. package/android/consumer-rules.pro +48 -0
  6. package/android/proguard-rules.pro +23 -0
  7. package/android/src/main/AndroidManifest.xml +0 -1
  8. package/android/src/main/java/ee/forgr/capacitor_updater/AndroidAppExitReporter.java +92 -0
  9. package/android/src/main/java/ee/forgr/capacitor_updater/AppLifecycleObserver.java +115 -0
  10. package/android/src/main/java/ee/forgr/capacitor_updater/BundleInfo.java +227 -195
  11. package/android/src/main/java/ee/forgr/capacitor_updater/BundleStatus.java +24 -23
  12. package/android/src/main/java/ee/forgr/capacitor_updater/Callback.java +13 -0
  13. package/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdaterPlugin.java +7927 -1243
  14. package/android/src/main/java/ee/forgr/capacitor_updater/CapgoUpdater.java +5785 -0
  15. package/android/src/main/java/ee/forgr/capacitor_updater/CryptoCipher.java +564 -121
  16. package/android/src/main/java/ee/forgr/capacitor_updater/DataManager.java +44 -0
  17. package/android/src/main/java/ee/forgr/capacitor_updater/DelayCondition.java +43 -49
  18. package/android/src/main/java/ee/forgr/capacitor_updater/DelayUntilNext.java +4 -4
  19. package/android/src/main/java/ee/forgr/capacitor_updater/DelayUpdateUtils.java +427 -0
  20. package/android/src/main/java/ee/forgr/capacitor_updater/DeviceIdHelper.java +230 -0
  21. package/android/src/main/java/ee/forgr/capacitor_updater/DownloadService.java +2041 -118
  22. package/android/src/main/java/ee/forgr/capacitor_updater/DownloadWorkerManager.java +301 -0
  23. package/android/src/main/java/ee/forgr/capacitor_updater/HeadlessUpdateWorker.java +569 -0
  24. package/android/src/main/java/ee/forgr/capacitor_updater/Http3.java +436 -0
  25. package/android/src/main/java/ee/forgr/capacitor_updater/HttpEngineTransport.java +604 -0
  26. package/android/src/main/java/ee/forgr/capacitor_updater/InternalUtils.java +79 -0
  27. package/android/src/main/java/ee/forgr/capacitor_updater/Logger.java +419 -0
  28. package/android/src/main/java/ee/forgr/capacitor_updater/NativeUpdatePrompt.java +303 -0
  29. package/android/src/main/java/ee/forgr/capacitor_updater/ShakeDetector.java +72 -0
  30. package/android/src/main/java/ee/forgr/capacitor_updater/ShakeMenu.java +963 -0
  31. package/android/src/main/java/ee/forgr/capacitor_updater/StatsBatchFailureDiagnostics.java +40 -0
  32. package/android/src/main/java/ee/forgr/capacitor_updater/ThreeFingerPinchDetector.java +323 -0
  33. package/android/src/main/java/ee/forgr/capacitor_updater/Version.java +306 -0
  34. package/dist/docs.json +4431 -840
  35. package/dist/esm/definitions.d.ts +2641 -225
  36. package/dist/esm/definitions.js +103 -1
  37. package/dist/esm/definitions.js.map +1 -1
  38. package/dist/esm/history.d.ts +1 -0
  39. package/dist/esm/history.js +283 -0
  40. package/dist/esm/history.js.map +1 -0
  41. package/dist/esm/index.d.ts +3 -2
  42. package/dist/esm/index.js +5 -4
  43. package/dist/esm/index.js.map +1 -1
  44. package/dist/esm/web.d.ts +53 -42
  45. package/dist/esm/web.js +180 -37
  46. package/dist/esm/web.js.map +1 -1
  47. package/dist/plugin.cjs.js +570 -37
  48. package/dist/plugin.cjs.js.map +1 -1
  49. package/dist/plugin.js +570 -37
  50. package/dist/plugin.js.map +1 -1
  51. package/ios/Sources/CapacitorUpdaterPlugin/AES.swift +262 -0
  52. package/ios/Sources/CapacitorUpdaterPlugin/AppHealthTracker.swift +82 -0
  53. package/ios/Sources/CapacitorUpdaterPlugin/BundleInfo.swift +185 -0
  54. package/ios/Sources/CapacitorUpdaterPlugin/BundleStatus.swift +127 -0
  55. package/ios/Sources/CapacitorUpdaterPlugin/CapacitorUpdaterPlugin.swift +6813 -0
  56. package/ios/Sources/CapacitorUpdaterPlugin/CapgoRawRsa.swift +36 -0
  57. package/ios/Sources/CapacitorUpdaterPlugin/CapgoSemanticVersion.swift +200 -0
  58. package/ios/Sources/CapacitorUpdaterPlugin/CapgoUpdater.swift +5099 -0
  59. package/ios/Sources/CapacitorUpdaterPlugin/CryptoCipher.swift +387 -0
  60. package/ios/Sources/CapacitorUpdaterPlugin/DelayUpdateUtils.swift +343 -0
  61. package/ios/Sources/CapacitorUpdaterPlugin/DeviceIdHelper.swift +120 -0
  62. package/ios/Sources/CapacitorUpdaterPlugin/InternalUtils.swift +452 -0
  63. package/ios/Sources/CapacitorUpdaterPlugin/Logger.swift +380 -0
  64. package/ios/Sources/CapacitorUpdaterPlugin/NativeUpdatePrompt.swift +183 -0
  65. package/ios/Sources/CapacitorUpdaterPlugin/RSA.swift +96 -0
  66. package/ios/Sources/CapacitorUpdaterPlugin/RedirectPolicyDelegate.swift +97 -0
  67. package/ios/Sources/CapacitorUpdaterPlugin/ShakeMenu.swift +876 -0
  68. package/ios/{Plugin → Sources/CapacitorUpdaterPlugin}/UserDefaultsExtension.swift +0 -2
  69. package/ios/Sources/CapacitorUpdaterPlugin/WKWebView+CapgoObjcBridge.swift +20 -0
  70. package/ios/Sources/CapacitorUpdaterPlugin/WebViewStatsReporter.swift +304 -0
  71. package/ios/Sources/CapacitorUpdaterPlugin/ZipArchiveReader.swift +247 -0
  72. package/ios/Sources/CapacitorUpdaterPlugin/ZipCentralDirectory.swift +280 -0
  73. package/ios/Tests/CapacitorUpdaterPluginTests/BuiltinHashesTests.swift +210 -0
  74. package/ios/Tests/CapacitorUpdaterPluginTests/BundleHardeningTests.swift +292 -0
  75. package/ios/Tests/CapacitorUpdaterPluginTests/CapacitorUpdaterPluginTests.swift +6533 -0
  76. package/ios/Tests/CapacitorUpdaterPluginTests/CapgoSemanticVersionTests.swift +64 -0
  77. package/ios/Tests/CapacitorUpdaterPluginTests/ChecksumRequiredTests.swift +156 -0
  78. package/ios/Tests/CapacitorUpdaterPluginTests/CliCryptoFixtureTests.swift +314 -0
  79. package/ios/Tests/CapacitorUpdaterPluginTests/HttpsOnlyBuiltinMinimumTests.swift +653 -0
  80. package/ios/Tests/CapacitorUpdaterPluginTests/InstallPerfTests.swift +174 -0
  81. package/ios/Tests/CapacitorUpdaterPluginTests/ListChannelsTests.swift +74 -0
  82. package/ios/Tests/CapacitorUpdaterPluginTests/LoggerSecurityTests.swift +149 -0
  83. package/ios/Tests/CapacitorUpdaterPluginTests/NativeContractTests.swift +160 -0
  84. package/ios/Tests/CapacitorUpdaterPluginTests/NetworkTransportTests.swift +1109 -0
  85. package/ios/Tests/CapacitorUpdaterPluginTests/PopulateDeltaCacheTests.swift +573 -0
  86. package/ios/Tests/CapacitorUpdaterPluginTests/RedirectPolicyTests.swift +63 -0
  87. package/ios/Tests/CapacitorUpdaterPluginTests/RsaContractTests.swift +281 -0
  88. package/ios/Tests/CapacitorUpdaterPluginTests/SessionKeyRequiredTests.swift +196 -0
  89. package/ios/Tests/CapacitorUpdaterPluginTests/TestZipWriter.swift +235 -0
  90. package/ios/Tests/CapacitorUpdaterPluginTests/UpdateLifecycleTests.swift +470 -0
  91. package/ios/Tests/CapacitorUpdaterPluginTests/WebKitOverlayGuardTests.swift +32 -0
  92. package/ios/Tests/CapacitorUpdaterPluginTests/ZipArchiveReaderTests.swift +302 -0
  93. package/ios/Tests/CapacitorUpdaterPluginTests/ZipBundleExtractionTests.swift +122 -0
  94. package/package.json +80 -43
  95. package/scripts/builtin-hashes-lib.mjs +148 -0
  96. package/scripts/capacitor-builtin-hashes-hook.mjs +65 -0
  97. package/scripts/resolve-real-path.mjs +25 -0
  98. package/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdater.java +0 -1130
  99. package/ios/Plugin/BundleInfo.swift +0 -113
  100. package/ios/Plugin/BundleStatus.swift +0 -48
  101. package/ios/Plugin/CapacitorUpdater.swift +0 -858
  102. package/ios/Plugin/CapacitorUpdaterPlugin.h +0 -10
  103. package/ios/Plugin/CapacitorUpdaterPlugin.m +0 -27
  104. package/ios/Plugin/CapacitorUpdaterPlugin.swift +0 -677
  105. package/ios/Plugin/CryptoCipher.swift +0 -240
  106. /package/{LICENCE → LICENSE} +0 -0
  107. /package/ios/{Plugin → Sources/CapacitorUpdaterPlugin}/DelayCondition.swift +0 -0
  108. /package/ios/{Plugin → Sources/CapacitorUpdaterPlugin}/DelayUntilNext.swift +0 -0
  109. /package/ios/{Plugin → Sources/CapacitorUpdaterPlugin}/Info.plist +0 -0
package/README.md CHANGED
@@ -1,5 +1,59 @@
1
1
  # Capacitor updater
2
- <a href="https://capgo.app/"><img src='https://raw.githubusercontent.com/Cap-go/capgo/main/assets/capgo_banner.png' alt='Capgo - Instant updates for capacitor'/></a>
2
+
3
+ Ship live updates to your Capacitor app: push JavaScript, HTML and CSS fixes to users right away without waiting for store review, with Capgo Cloud or your own server.
4
+
5
+ This plugin is the live update layer of [Capgo](https://capgo.app/), the AI-ready platform to build, ship, and maintain Capacitor apps: Capacitor skills and MCP servers for AI coding agents (Claude Code, Codex, Cursor, Copilot, Gemini CLI), [maintained Capacitor plugins](https://capgo.app/plugins/), [cloud native iOS/Android builds](https://capgo.app/native-build/) with App Store and Google Play publishing, live updates with channels and rollback, and release monitoring.
6
+
7
+ <a href="https://capgo.app/?ref=plugin_updater_v7"><img src="https://capgo.app/readme-banner.svg?repo=Cap-go/capacitor-updater" alt="Capgo - Instant updates for Capacitor" /></a>
8
+
9
+ <div align="center">
10
+ <p><b>Capgo</b>: the AI-ready platform to build, ship, and maintain Capacitor apps. Ship live updates to your users instantly, without waiting for app store review.</p>
11
+ <h2><a href="https://capgo.app/register/?ref=plugin_updater_v7">➡️ Get started for free</a></h2>
12
+ <p>14-day unlimited free trial. No credit card required</p>
13
+ <p><a href="https://capgo.app/consulting/?ref=plugin_updater_v7">Missing a feature? We'll build the plugin for you 💪</a></p>
14
+ </div>
15
+
16
+ <p align="center">
17
+ <img src="https://raw.githubusercontent.com/Cap-go/capacitor-updater/main/assets/github-social-preview.png" alt="@capgo/capacitor-updater for Capacitor apps" width="300" />
18
+ </p>
19
+
20
+ ## Built and maintained with AI
21
+
22
+ We build, improve and fix our plugins with heavy use of AI, so issues usually get fixed in under a day and pull requests get feedback the same day. A human still reviews, tests and merges 50+ pull requests daily.
23
+
24
+ - Most plugin issues get a fix pull request the same day, often within a couple of hours, and are usually resolved in one to two days.
25
+ - Every pull request goes through our AI review system, usually within minutes.
26
+ - Our AI pre-checks tests, code review, conventions and security, then a human reviews, tests and merges.
27
+ - A human, Martin, reviews, tests and merges 50+ pull requests every day.
28
+ - In the last 90 days, 95% of plugin issues were resolved.
29
+
30
+ [Learn more about how we build with AI](https://capgo.app/docs/plugins/ai-engineering/)
31
+
32
+ ## Use with AI coding agents
33
+
34
+ Capgo provides skills and a hosted MCP server so AI coding agents can set up and operate Capacitor apps, including this plugin.
35
+
36
+ - **Skills**: install the [Capgo skills](https://capgo.app/skills/) ([source](https://github.com/Cap-go/capgo-skills)) in your agent:
37
+
38
+ ```bash
39
+ npx skills add Cap-go/capgo-skills
40
+ ```
41
+
42
+ - **Hosted MCP server**: `https://api.capgo.app/mcp` ([docs](https://capgo.app/docs/ai/mcp/)).
43
+ - **Agent setup guides**: [capgo.app/agents](https://capgo.app/agents/) and [AI tools for Capacitor](https://capgo.app/best/ai-tools-for-capacitor/).
44
+
45
+ ## Key features
46
+
47
+ - **Auto update**: downloads and applies the latest bundle from Capgo Cloud or your own update server.
48
+ - **Interrupted downloads**: auto update retries incomplete downloads after app kill or background interruption. Interrupted transfers and bundles that fail checksum or decryption share a budget of 3 retries per version (reset after a successful install), and a `download_fail` stat is sent on the next launch (best effort: like other stats, it is not queued durably). Every retry is verified again.
49
+ - **Safe rollouts**: `notifyAppReady()` confirms a bundle works, otherwise the app rolls back to the last working one.
50
+ - **Bundle control**: `download()`, `next()`, `set()`, `list()`, `delete()` and `reset()` for manual flows.
51
+ - **Channels**: `setChannel()`, `getChannel()` and `listChannels()` for environments and per-device QA.
52
+ - **Delta updates and security**: only changed files are downloaded, checksums are verified, and encryption is optional.
53
+ - **HTTP/3 downloads**: bundles download over HTTP/3 when your CDN supports it (Android 14+ through `HttpEngine`, iOS through URLSession), with automatic fallback to HTTP/2.
54
+ - **Preview sessions**: `startPreviewSession()`, `setPreview()` and `resetPreview()` to test bundles on a device.
55
+ - **Platforms**: iOS and Android. Web is a stub for development.
56
+
3
57
  [![Discord](https://badgen.net/badge/icon/discord?icon=discord&label)](https://discord.com/invite/VnYRvBfgA6)
4
58
  <a href="https://discord.com/invite/VnYRvBfgA6"><img src="https://img.shields.io/discord/912707985829163099?color=%237289DA&label=Discord" alt="Discord">
5
59
  [![npm](https://img.shields.io/npm/dm/@capgo/capacitor-updater)](https://www.npmjs.com/package/@capgo/capacitor-updater)
@@ -15,39 +69,267 @@
15
69
  [![Open Bounties](https://img.shields.io/endpoint?url=https%3A%2F%2Fconsole.algora.io%2Fapi%2Fshields%2FCapgo%2Fbounties%3Fstatus%3Dopen)](https://console.algora.io/org/Capgo/bounties?status=open)
16
70
  [![Rewarded Bounties](https://img.shields.io/endpoint?url=https%3A%2F%2Fconsole.algora.io%2Fapi%2Fshields%2FCapgo%2Fbounties%3Fstatus%3Dcompleted)](https://console.algora.io/org/Capgo/bounties?status=completed)
17
71
 
18
- Update Ionic Capacitor apps without App/Play Store review (Code-push / hot-code updates).
72
+ Capacitor plugin to update your app remotely in real-time.
73
+
74
+ Open-source Alternative to Appflow, Codepush or Capawesome
75
+
76
+ ## Why Capacitor Updater?
77
+
78
+ App store review processes can take days or weeks, blocking critical bug fixes and updates from reaching your users. Capacitor Updater solves this by:
79
+
80
+ - **Instant updates** - Push JavaScript/HTML/CSS updates directly to users without app store review
81
+ - **Delta updates** - Only download changed files, making updates ultra-fast
82
+ - **Rollback protection** - Automatically revert broken updates to keep your app stable
83
+ - **Open source** - Self-host or use Capgo Cloud, with full control over your update infrastructure
84
+ - **Battle-tested** - Used by 3000+ production apps with proven reliability
85
+ - **Most stared** - Capacitor updater is the most stared Capacitor plugin on GitHub
86
+
87
+ Perfect for fixing bugs immediately, A/B testing features, and maintaining control over your release schedule.
88
+
89
+ ## Features
90
+
91
+ - ☁️ Cloud / Self hosted Support: Use our [Cloud](https://capgo.app/) to manage your app updates or yours.
92
+ - 📦 Bundle Management: Download, assign to channel, rollback.
93
+ - 📺 Channel Support: Use channels to manage different environments.
94
+ - 🎯 Set Channel to specific device to do QA or debug one user.
95
+ - 🔄 Auto Update: Automatically download and set the latest bundle for the app.
96
+ - 🛟 Rollback: Reset the app to last working bundle if an incompatible bundle has been set.
97
+ - 🔁 **Delta Updates**: Make instant updates by only downloading changed files.
98
+ - 🚀 **HTTP/3 Downloads**: Bundles download over HTTP/3 (QUIC) when the CDN supports it, with automatic HTTP/2 fallback.
99
+ - 🔒 Security: checksum on every update; encryption optional for high-security apps.
100
+ - ⚔️ **Battle-Tested**: Used in more than 3000 projects.
101
+ - 📊 View your deployment statistics
102
+ - 🔋 Supports Android and iOS
103
+ - ⚡️ Capacitor 4/5/6/7/8 support
104
+ - 🌐 **Open Source**: Licensed under the Mozilla Public License 2.0
105
+ - 🌐 **Open Source Backend**: Self install [our backend](https://github.com/Cap-go/capgo) in your infra
106
+
19
107
 
20
108
  You have 3 ways possible :
21
- - Use [capgo.app](https://capgo.app) a full featured auto update system in 5 min Setup, to manage version, update, revert and see stats.
22
- - Use your own server update with auto update system
109
+ - Use [capgo.app](https://capgo.app) a full featured auto-update system in 5 min Setup, to manage version, update, revert and see stats.
110
+ - Use your own server update with auto-update system
23
111
  - Use manual methods to zip, upload, download, from JS to do it when you want.
24
112
 
113
+ ## Documentation
114
+ The most complete [documentation here](https://capgo.app/docs/).
25
115
 
26
116
  ## Community
27
117
  Join the [discord](https://discord.gg/VnYRvBfgA6) to get help.
28
118
 
29
- ## Documentation
30
- I maintain a more user friendly and complete [documentation here](https://docs.capgo.app/).
119
+ ## Migration to v9
120
+
121
+ This version requires Capacitor 9.0.0 or later within major version 9, including the iOS listener override fix.
122
+ Both CocoaPods and Swift Package Manager integrations require iOS 16 or later.
123
+
124
+ This major version follows Capacitor major version 9. It removes every API deprecated in v8 and turns on stricter defaults.
125
+
126
+ First follow the migration guide of Capacitor:
127
+
128
+ [https://capacitorjs.com/docs/next/updating/9-0](https://capacitorjs.com/docs/next/updating/9-0)
129
+
130
+ ### Removed APIs
131
+
132
+ - **Per-event listeners**: `addListener('download', ...)`, `addListener('appReady', ...)`, and every other per-event listener were removed. The plugin now emits only `updaterEvent`. Listen to it and switch on `event.type`; `event.data` is the payload the old listener received:
133
+
134
+ ```typescript
135
+ // Before (v8)
136
+ CapacitorUpdater.addListener('download', (info) => console.log(info.percent));
137
+ CapacitorUpdater.addListener('appReady', (info) => console.log(info.status));
138
+
139
+ // After (v9)
140
+ CapacitorUpdater.addListener('updaterEvent', (event) => {
141
+ switch (event.type) {
142
+ case 'download':
143
+ console.log(event.data.percent);
144
+ break;
145
+ case 'appReady':
146
+ console.log(event.data.status);
147
+ break;
148
+ }
149
+ });
150
+ ```
151
+
152
+ Native code no longer sends the per-event names, so a listener registered with an old name never fires.
153
+ - **`majorAvailable` event and `MajorAvailableEvent` type**: use the `breakingAvailable` type of `updaterEvent` and `BreakingAvailableEvent`.
154
+ - **`LatestVersion.major`**: use `LatestVersion.breaking`.
155
+ - **`directUpdate` config**: use the `autoUpdate` string modes. The plugin ignores `directUpdate` and logs an error at startup when it is still set.
156
+
157
+ | v8 config | v9 config |
158
+ | --- | --- |
159
+ | `autoUpdate: true, directUpdate: false` | `autoUpdate: true` (or `"atBackground"`) |
160
+ | `autoUpdate: true, directUpdate: true` | `autoUpdate: "always"` |
161
+ | `autoUpdate: true, directUpdate: "always"` | `autoUpdate: "always"` |
162
+ | `autoUpdate: true, directUpdate: "atInstall"` | `autoUpdate: "atInstall"` |
163
+ | `autoUpdate: true, directUpdate: "onLaunch"` | `autoUpdate: "onLaunch"` |
164
+ - **Base64 encrypted checksums**: the native code only accepts the hex checksum format that the Capgo CLI has produced since plugin versions 5.30.0, 6.30.0 and 7.30.0. Re-upload bundles made with an older CLI. The CRC32 checksum labels were removed too: SHA-256 is the only supported checksum.
165
+ - **Encrypted checksums that sign only the decrypted bundle**: for encrypted bundles and encrypted delta files, v9 checks the downloaded encrypted bytes against the signed checksum before it decrypts anything. The checksum must sign the SHA-256 of the bundle (or file) followed by the SHA-256 of the encrypted bytes. The Capgo CLI produces this format when it detects `@capgo/capacitor-updater` 9 in the project: upload encrypted bundles with `npx @capgo/cli@latest`, and re-upload encrypted bundles made with an older CLI. Unencrypted bundles are not affected.
166
+
167
+ This format only works on v9. A v8 app that receives an encrypted bundle signed this way fails its checksum check, deletes the download, and stays on its current bundle until the native app is upgraded to v9. If v8 apps are still in the field, make sure they never receive these bundles. For example, keep them on a channel that only serves bundles uploaded for v8.
168
+ - **Android `CapgoUpdater.autoReset()`** without arguments: call `autoReset(currentNativeBuildVersion)`.
169
+
170
+ ### New defaults
171
+
172
+ | Option | v8 default | v9 default | Keep the v8 behavior |
173
+ | --- | --- | --- | --- |
174
+ | `builtinMinimum` | `false` | `true` | `builtinMinimum: false` if you version web bundles independently of the native app |
175
+ | `persistCustomId` | `false` | `true` | `persistCustomId: false` to keep the custom ID for the current session only |
176
+
177
+ `httpsOnly` stays `true` (the default since 8.54.0).
178
+
179
+ ## Migration to v8
180
+
181
+ This major version is here to follow Capacitor major version 8
182
+
183
+ First follow the migration guide of Capacitor:
184
+
185
+ [https://capacitorjs.com/docs/updating/8-0](https://capacitorjs.com/docs/updating/8-0/)
186
+
187
+ ## Migration to v7.34
188
+
189
+ - **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.
190
+ - Channel assignments persist between app restarts
191
+ - Use `unsetChannel()` to clear the local assignment and revert to `defaultChannel`
192
+ - Old devices (< v7.34.0) use now a KV storage to prevent overload the primary DB of Capgo
193
+ - **New event**: Listen to the `channelPrivate` event to handle cases where a user tries to assign themselves to a private channel (one that doesn't allow self-assignment). See example in the `setChannel()` documentation above.
194
+
195
+ ## Migration to v7
196
+
197
+ The minimum iOS version is now **15.0** to match Capacitor 7/8 requirements.
198
+
199
+ The plugin has no third-party iOS dependencies besides Capacitor: ZIP extraction uses a built-in reader on top of Apple's native `Compression` framework, and networking uses `URLSession`.
200
+
201
+ ## Compatibility
202
+
203
+ | Plugin version | Capacitor compatibility | Maintained |
204
+ | -------------- | ----------------------- | ----------------- |
205
+ | v9.\*.\* | v9.\*.\* | ✅ |
206
+ | v8.\*.\* | v8.\*.\* | ✅ |
207
+ | v7.\*.\* | v7.\*.\* | ✅ |
208
+ | v6.\*.\* | v6.\*.\* | ✅ |
209
+ | v5.\*.\* | v5.\*.\* | ✅ |
210
+ | v4.\*.\* | v4.\*.\* | ✅ |
211
+ | v3.\*.\* | v3.\*.\* | ⚠️ Deprecated |
212
+ | > 7 | v4.\*.\* | ⚠️ Deprecated, our CI got crazy and bumped too much version |
213
+
214
+ > **Note:** Versions 4, 5, 6, 7, and 8 all share the same features. The major version simply follows your Capacitor version. You can safely use any of these versions that matches your Capacitor installation. Version 9 removes the APIs deprecated in v8 and turns on stricter defaults: see [Migration to v9](#migration-to-v9).
215
+
216
+ ### iOS
217
+
218
+ #### Privacy manifest
219
+
220
+ Add the `NSPrivacyAccessedAPICategoryUserDefaults` dictionary key to your [Privacy Manifest](https://capacitorjs.com/docs/ios/privacy-manifest) (usually `ios/App/PrivacyInfo.xcprivacy`):
221
+
222
+ ```xml
223
+ <?xml version="1.0" encoding="UTF-8"?>
224
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
225
+ <plist version="1.0">
226
+ <dict>
227
+ <key>NSPrivacyAccessedAPITypes</key>
228
+ <array>
229
+ <!-- Add this dict entry to the array if the file already exists. -->
230
+ <dict>
231
+ <key>NSPrivacyAccessedAPIType</key>
232
+ <string>NSPrivacyAccessedAPICategoryUserDefaults</string>
233
+ <key>NSPrivacyAccessedAPITypeReasons</key>
234
+ <array>
235
+ <string>CA92.1</string>
236
+ </array>
237
+ </dict>
238
+ </array>
239
+ </dict>
240
+ </plist>
241
+ ```
242
+
243
+ We recommend to declare [`CA92.1`](https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_use_of_required_reason_api#4278401) as the reason for accessing the [`UserDefaults`](https://developer.apple.com/documentation/foundation/userdefaults) API.
31
244
 
32
245
  ## Installation
33
246
 
247
+ You can use our AI-Assisted Setup to install the plugin. Add the Capgo skills to your AI tool using the following command:
248
+
249
+ ```bash
250
+ npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins
251
+ ```
252
+
253
+ Then use the following prompt:
254
+
255
+ ```text
256
+ Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-updater` plugin in my project.
257
+ ```
258
+
259
+ If you prefer Manual Setup, install the plugin by running the following commands and follow the platform-specific instructions below:
260
+
261
+ Step by step here: [Getting started](https://capgo.app/docs/getting-started/add-an-app/)
262
+
263
+ Or
264
+
34
265
  ```bash
35
266
  npm install @capgo/capacitor-updater
36
267
  npx cap sync
37
268
  ```
38
269
 
270
+ ### Install a specific version
271
+
272
+ Use npm tags to install the version matching your Capacitor version:
273
+
274
+ ```bash
275
+ # For Capacitor 9 (latest)
276
+ npm install @capgo/capacitor-updater@latest
277
+
278
+ # For Capacitor 8
279
+ npm install @capgo/capacitor-updater@^8
280
+
281
+ # For Capacitor 7
282
+ npm install @capgo/capacitor-updater@lts-v7
283
+
284
+ # For Capacitor 6
285
+ npm install @capgo/capacitor-updater@lts-v6
286
+
287
+ # For Capacitor 5
288
+ npm install @capgo/capacitor-updater@lts-v5
289
+
290
+ # For Capacitor 4
291
+ npm install @capgo/capacitor-updater@lts-v4
292
+ ```
293
+
294
+ ### Android: builtin hash table and compressed assets
295
+
296
+ On `npx cap copy`, the plugin writes `ota-builtin-hashes.json` next to your web assets so the native code can reuse builtin files without hashing them. On Android each sized row checks that the asset's uncompressed length still matches the manifest before trusting the stored SHA-256 (same integrity model as iOS file size checks). `AssetManager.openFd()` only works for uncompressed APK assets; when it fails, the plugin reads the uncompressed length via `AssetManager.open()` instead, so the fast path works for default aapt-compressed web bundles (`.js`, `.css`, `.html`, and similar) without `noCompress`.
297
+
298
+ Optional: listing extensions in `androidResources { noCompress += [...] }` avoids opening a stream for the length check on those files, but increases installed APK size. Without it, updates still verify every builtin file by checksum when the table cannot answer.
299
+
300
+ ```groovy
301
+ android {
302
+ androidResources {
303
+ noCompress += ['html', 'js', 'css', 'json', 'svg', 'woff', 'woff2', 'ttf', 'eot', 'map', 'png', 'jpg', 'jpeg', 'webp', 'gif', 'ico', 'wasm', 'txt', 'xml']
304
+ }
305
+ }
306
+ ```
307
+
39
308
  ## Auto-update setup
40
309
 
41
- Create your account in [capgo.app](https://capgo.app) and get your [API key](https://capgo.app/app/apikeys)
310
+ Create your account in [capgo.app](https://capgo.app) and get your [API key](https://console.capgo.app/dashboard/apikeys)
42
311
  - Login to CLI `npx @capgo/cli@latest init API_KEY`
43
312
  And follow the steps by step to setup your app.
44
313
 
45
- See more there in the [Auto update documentation](https://docs.capgo.app/plugin/auto-update).
314
+ For detailed instructions on the auto-update setup, refer to the [Auto update documentation](https://capgo.app/docs/plugin/cloud-mode/getting-started/).
315
+
316
+ ### Instant apply (`always`, `atInstall`, `onLaunch`)
317
+
318
+ These modes apply the update while the user is waiting. Upload with `--delta` so only changed files download:
319
+
320
+ ```bash
321
+ npx @capgo/cli@latest bundle upload --delta
322
+ ```
323
+
324
+ We recommend showing a splash screen while an instant update applies. To enable automatic splash handling, install `@capacitor/splash-screen`, set `autoSplashscreen: true`, and set `SplashScreen.launchAutoHide: false`. See [Update Behavior](https://capgo.app/docs/live-updates/update-behavior/).
46
325
 
326
+ On iOS, use at least `@capgo/capacitor-updater@8.51.22`. The same fix is in the LTS lines from `7.51.21`, `6.51.21`, and `5.51.21`. The Capacitor 4 line (`@lts-v4`) never shipped `autoSplashscreen`, so this rejection does not apply there.
47
327
 
48
- ## Manual setup
328
+ Earlier 5, 6, 7, and 8 builds compiled `autoSplashscreen` so it built the splash screen `show` / `hide` selector at runtime with `NSSelectorFromString`, then called it with `responds(to:)` and `perform`. App Review rejected that binary under [Guideline 2.5.2](https://developer.apple.com/app-store/review/guidelines/#software-requirements). The rejection names code that passes arbitrary parameters to dynamic methods such as `respondsToSelector:` and `performSelector:`, next to a plugin that downloads a remote bundle. See [#913](https://github.com/Cap-go/capacitor-updater/issues/913). Those calls stay in the binary when `autoSplashscreen` is off, so turning the option off does not clear the rejection. Upgrade to the latest plugin for your Capacitor major and submit a new native build.
49
329
 
50
- Download update distribution zipfiles from a custom url. Manually control the entire update process.
330
+ ## No Cloud setup
331
+
332
+ Download update distribution zipfiles from a custom URL. Manually control the entire update process.
51
333
 
52
334
  - Edit your `capacitor.config.json` like below, set `autoUpdate` to false.
53
335
  ```json
@@ -67,10 +349,11 @@ Download update distribution zipfiles from a custom url. Manually control the en
67
349
  import { CapacitorUpdater } from '@capgo/capacitor-updater'
68
350
  CapacitorUpdater.notifyAppReady()
69
351
  ```
70
- This informs Capacitor Updator that the current update bundle has loaded succesfully. Failing to call this method will cause your application to be rolled back to the previously successful version (or built-in bundle).
352
+ This informs Capacitor Updater that the current update bundle has loaded successfully. Failing to call this method will cause your application to be rolled back to the previously successful version (or built-in bundle).
71
353
  - Add this to your application.
72
354
  ```javascript
73
355
  const version = await CapacitorUpdater.download({
356
+ version: '0.0.4',
74
357
  url: 'https://github.com/Cap-go/demo-app/releases/download/0.0.4/dist.zip',
75
358
  })
76
359
  await CapacitorUpdater.set(version); // sets the new version, and reloads the app
@@ -88,6 +371,7 @@ You might also consider performing auto-update when application state changes, a
88
371
  if (state.isActive) {
89
372
  // Ensure download occurs while the app is active, or download may fail
90
373
  version = await CapacitorUpdater.download({
374
+ version: '0.0.4',
91
375
  url: 'https://github.com/Cap-go/demo-app/releases/download/0.0.4/dist.zip',
92
376
  })
93
377
  }
@@ -106,571 +390,2165 @@ You might also consider performing auto-update when application state changes, a
106
390
 
107
391
  ```
108
392
 
109
- TIP: If you prefer a secure and automated way to update your app, you can use [capgo.app](https://capgo.app) - a full-featured, auto update system.
393
+ TIP: If you prefer a secure and automated way to update your app, you can use [capgo.app](https://capgo.app) - a full-featured, auto-update system.
394
+
395
+ ### Store Guideline Compliance
396
+
397
+ Live updates of JavaScript, HTML, and CSS are allowed on Google Play and the App Store. This plugin replaces the web bundle that already runs in the WebView. It does not download or install native executable code.
398
+
399
+ #### Google Play
400
+
401
+ [Device and Network Abuse](https://support.google.com/googleplay/android-developer/answer/13315670) forbids an app from updating itself outside Google Play or from downloading executable code (dex, JAR, `.so`). The same policy exempts the web layer:
402
+
403
+ > This restriction does not apply to code that runs in a virtual machine or an interpreter where either provides indirect access to Android APIs (such as JavaScript in a webview or browser).
404
+
405
+ JavaScript loaded at runtime must still respect the rest of the Play policies. Capacitor-updater only ships that JavaScript bundle. It cannot change native code, permissions, or the store binary.
406
+
407
+ #### App Store
408
+
409
+ Section **3.3.1(B) Executable Code** of the [Apple Developer Program License Agreement](https://developer.apple.com/support/terms/apple-developer-program-license-agreement/) allows interpreted code:
410
+
411
+ > Except as set forth in the next paragraph, an Application may not download or install executable code. Interpreted code may be downloaded to an Application but only so long as such code: (a) does not change the primary purpose of the Application by providing features or functionality that are inconsistent with the intended and advertised purpose of the Application (b) does not bypass signing, sandbox, or other security features of the OS; and (c) for Applications distributed on the App Store, does not create a store or storefront for other Applications.
412
+
413
+ A bundle that keeps the app's reviewed purpose, stays in the sandbox, and does not open a store for other apps is inside that rule.
414
+
415
+ A reviewer can still misread the binary or the launch UI and reject the build. On iOS that usually arrives as [Guideline 2.5.2](https://developer.apple.com/app-store/review/guidelines/#software-requirements). It is rare. Reply in the store console and explain that the plugin downloads interpreted JavaScript, HTML, and CSS for the existing WebView, which the rules above permit, and that it does not download native executable code. Following the recommendations in this README is what keeps that from happening: ship a plugin build new enough that the old `autoSplashscreen` selector code is gone, and do not mention updates, live updates, or remote updates anywhere in the app.
416
+
417
+ To further remain in compliance with Apple's guidelines, we suggest that App Store-distributed apps don't enable the `Force update` scenario, since in the [App Store Review Guidelines](https://developer.apple.com/app-store/review/guidelines/) it is written that:
418
+
419
+ > Apps must not force users to rate the app, review the app, download other apps, or other similar actions to access functionality, content, or use of the app.
420
+
421
+ This is not a problem for the default behavior of background update, since it won't force the user to apply the new version until the next app close, but at least you should be aware of that ruling if you decide to show it.
422
+
423
+ #### Prevent live updates during Apple and Google review
424
+
425
+ Keep the app on the web assets shipped in the submitted native binary throughout Apple App Store and Google Play review. Applying a live update during review can reload the app, interrupt the reviewer's session, or change the behavior they are reviewing.
426
+
427
+ Capgo Cloud blocks update requests from known Apple and Google datacenter networks by default to prevent live updates from reaching review devices on those networks. Keep the app's **Block provider infrastructure requests** setting enabled. This protection runs on Capgo's server and depends on recognizing the request's network; it does not detect every review session or pause updates for all users while a store review is in progress.
428
+
429
+ If you self-host, manage updates manually, or disable this protection, you must provide your own way to prevent live updates from disturbing review. The same applies if review traffic does not use a recognized network. For example, pause update delivery for the submitted native version or use a dedicated channel that serves no live updates until review is complete. In manual flows, guard calls such as `download()`, `next()`, and `set()`, and prevent already downloaded or queued bundles from being applied during review. Hiding an update message does not prevent the update itself.
430
+
431
+ Before submitting, test a fresh install and an upgrade from the previous store version. Confirm that the submitted build keeps running its bundled web assets across launches and background/foreground transitions while the review hold is active.
432
+
433
+ #### Good practice for App Store review
434
+
435
+ Do not tell the user the app is updating. In any UI the user can see, including copy on top of the splash screen, settings, and buttons, do not say "update", "live update", "remote update", "OTA", "downloading", or "installing". A progress bar is fine when its label describes tailoring the experience, for example "Tailoring your experience…". Calling that wait an update reads as the app installing behavior that was not in the reviewed binary.
436
+
437
+ Do not add a button such as "Update the app" or "Apply update" to trigger the bundle. If you need the user to continue, the furthest the UI should go is asking them to reopen the app, for example "Please reopen the app". Do not say that reopening applies an update.
438
+
439
+ For the iOS plugin version that removes the `autoSplashscreen` code App Review flags, see [Instant apply](#instant-apply-always-atinstall-onlaunch).
110
440
 
111
441
  ### Packaging `dist.zip` update bundles
112
442
 
113
- Capacitor Updator works by unzipping a compiled app bundle to the native device filesystem. Whatever you choose to name the file you upload/download from your release/update server URL (via either manual or automatic updating), this `.zip` bundle must meet the following requirements:
443
+ Capacitor Updater works by unzipping a compiled app bundle to the native device filesystem. Whatever you choose to name the file you upload/download from your release/update server URL (via either manual or automatic updating), this `.zip` bundle must meet the following requirements:
114
444
 
115
445
  - The zip file should contain the full contents of your production Capacitor build output folder, usually `{project directory}/dist/` or `{project directory}/www/`. This is where `index.html` will be located, and it should also contain all bundled JavaScript, CSS, and web resources necessary for your app to run.
116
446
  - Do not password encrypt the bundle zip file, or it will fail to unpack.
117
447
  - Make sure the bundle does not contain any extra hidden files or folders, or it may fail to unpack.
118
448
 
449
+ ### Downgrading to a previous version of the updater plugin
450
+
451
+ Downgrading to a previous version of the updater plugin is not supported.
452
+
453
+ ## Updater Plugin Config
454
+
455
+ <docgen-config>
456
+ <!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
457
+
458
+ CapacitorUpdater can be configured with these options:
459
+
460
+ | Prop | Type | Description | Default | Since |
461
+ | -------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------ | ------- |
462
+ | **`appReadyTimeout`** | <code>number</code> | Configure the number of milliseconds the native plugin should wait before considering an update 'failed'. Only available for Android and iOS. | <code>10000 // (10 seconds)</code> | |
463
+ | **`responseTimeout`** | <code>number</code> | Configure the number of seconds the native plugin should wait before considering an HTTP timeout. Applies to update checks and file downloads. On Android these are idle connect/read/write timeouts and do not cap total download time; on iOS the request timeout also bounds the total download duration. Only available for Android and iOS. | <code>20 // (20 second)</code> | |
464
+ | **`autoDeleteFailed`** | <code>boolean</code> | Configure whether the plugin should use automatically delete failed bundles. Only available for Android and iOS. | <code>true</code> | |
465
+ | **`autoDeletePrevious`** | <code>boolean</code> | Configure whether the plugin should use automatically delete previous bundles after a successful update. Only available for Android and iOS. | <code>true</code> | |
466
+ | **`autoUpdate`** | <code>boolean \| 'always' \| 'off' \| 'atBackground' \| 'atInstall' \| 'onLaunch' \| 'onlyDownload'</code> | Configure how the plugin checks for, downloads, and applies live updates. The plugin checks for updates when the app moves to the foreground. When {@link periodCheckDelay} is greater than 0, it also checks on a repeating timer while the app stays open. Boolean values keep their existing behavior: - `true`: Same as `"atBackground"`. - `false`: Same as `"off"`. String values merge the previous Auto Update and Direct Update configuration: - `"off"`: Disable automatic update checks. - `"atBackground"`: Check and download automatically on each foreground check, then apply the update the next time the app moves to background. - `"atInstall"`: Apply immediately only after a fresh install or native app store update; otherwise use `"atBackground"` behavior. - `"onLaunch"`: Apply immediately only when the app is brought to the foreground from a killed state (cold start). After that first check, fall back to `"atBackground"` behavior. - `"always"`: Check on every foreground transition and apply immediately whenever an update is available. - `"onlyDownload"`: Check and download automatically, emit `updateAvailable`, and never set the next bundle or apply an update automatically. Instant apply modes (`"atInstall"`, `"onLaunch"`, `"always"`) apply while the user is waiting. Upload with `npx @capgo/cli@latest bundle upload --delta` so only changed files download. A full zip upload slows the user experience. They apply without `autoSplashscreen`, but `autoSplashscreen: true` (with `@capacitor/splash-screen` installed and `launchAutoHide: false`) is recommended so the splash screen covers the wait and hides itself afterwards. Only available for Android and iOS. | <code>true</code> | |
467
+ | **`resetWhenUpdate`** | <code>boolean</code> | Automatically delete previous downloaded bundles when a newer native app bundle is installed to the device. Setting this to false can broke the auto update flow if the user download from the store a native app bundle that is older than the current downloaded bundle. Upload will be prevented by channel setting downgrade_under_native. Only available for Android and iOS. | <code>true</code> | |
468
+ | **`updateUrl`** | <code>string</code> | Configure the URL / endpoint to which update checks are sent. Only available for Android and iOS. | <code>https://plugin.capgo.app/updates</code> | |
469
+ | **`channelUrl`** | <code>string</code> | Configure the URL / endpoint for channel operations. Only available for Android and iOS. | <code>https://plugin.capgo.app/channel_self</code> | |
470
+ | **`statsUrl`** | <code>string</code> | Configure the URL / endpoint to which update statistics are sent. Only available for Android and iOS. Set to "" to disable stats reporting. Native stats include update lifecycle events, app health signals such as crashes, Android ANRs, low-memory exits, iOS memory warnings, and WebView health signals such as JavaScript errors, unhandled promise rejections, resource load failures, WebView renderer exits, unclean WebView restarts, app launch readiness timing, and WebView load milestones when available. Failed background update checks that never start a download (network errors, timeouts, non-2xx responses, unreadable payloads) are reported as `update_check_error` with `metadata.error` and optional `metadata.status_code`, not as `download_fail`. Self-hosted Capgo backends must allow the `update_check_error` stats action. | <code>https://plugin.capgo.app/stats</code> | |
471
+ | **`publicKey`** | <code>string</code> | Configure the public key for end to end live update encryption Version 2. What it guarantees: a bundle can only be installed when its checksum and session key were produced with the matching private key. Capgo never holds that key, so Capgo cannot create, modify or decrypt an update for your app. It does NOT make the bundle unreadable to someone who has your app binary: the public key ships inside the app, and anyone holding the app can recover the session key and read the bundle. If you also need Capgo to be unable to find your app (and so its public key), use a Capgo app id that is not your store bundle id (`appId` in this plugin config) so the app is not identifiable from the dashboard. Only available for Android and iOS. | <code>undefined</code> | 6.2.0 |
472
+ | **`version`** | <code>string</code> | Configure the current version of the app. This will be used for the first update request. If not set, the plugin will get the version from the native code. Only available for Android and iOS. | <code>undefined</code> | 4.17.48 |
473
+ | **`autoSplashscreen`** | <code>boolean</code> | Let the plugin handle the splashscreen: keep it up while an instant apply update runs, then hide it when the update finishes, when no update is needed, or after {@link autoSplashscreenTimeout}. It controls splash handling only, not whether an update applies immediately (that is {@link autoUpdate}); it is recommended with the instant apply modes (`"atInstall"`, `"onLaunch"`, `"always"`) so users do not see the app reload. `@capacitor/splash-screen` must be installed and configured with `launchAutoHide: false`. This removes the need to manually listen for appReady events and call SplashScreen.hide(). Only available for Android and iOS. | <code>false</code> | 7.6.0 |
474
+ | **`autoSplashscreenLoader`** | <code>boolean</code> | Display a native loading indicator on top of the splashscreen while automatic direct updates are running. Only takes effect when {@link autoSplashscreen} is enabled. Requires the @capacitor/splash-screen plugin to be installed and configured with launchAutoHide: false. Only available for Android and iOS. | <code>false</code> | 7.19.0 |
475
+ | **`autoSplashscreenTimeout`** | <code>number</code> | Automatically hide the splashscreen after the specified number of milliseconds when using automatic direct updates. If the timeout elapses, the update continues to download in the background while the splashscreen is dismissed. Set to `0` (zero) to disable the timeout. If installation has not started when the timeout fires, the downloaded bundle is installed on the next background/launch. If installation has already started, the splashscreen still hides at the deadline while the reload and app-ready checks finish. This can briefly expose the previous page while the new bundle loads. Requires {@link autoSplashscreen} to be enabled. Only available for Android and iOS. | <code>10000 // (10 seconds)</code> | 7.19.0 |
476
+ | **`periodCheckDelay`** | <code>number</code> | Configure the interval in seconds for repeating update checks while the app stays open. Foreground checks still run when this is 0. Values below 600 are normalized to 600. Only available for Android and iOS. Cannot be less than 600 seconds (10 minutes). | <code>0 (disabled)</code> | |
477
+ | **`localS3`** | <code>boolean</code> | Configure the CLI to use a local server for testing or self-hosted update server. | <code>undefined</code> | 4.17.48 |
478
+ | **`localHost`** | <code>string</code> | Configure the CLI to use a local server for testing or self-hosted update server. | <code>undefined</code> | 4.17.48 |
479
+ | **`localWebHost`** | <code>string</code> | Configure the CLI to use a local server for testing or self-hosted update server. | <code>undefined</code> | 4.17.48 |
480
+ | **`localSupa`** | <code>string</code> | Configure the CLI to use a local server for testing or self-hosted update server. | <code>undefined</code> | 4.17.48 |
481
+ | **`localSupaAnon`** | <code>string</code> | Configure the CLI to use a local server for testing. | <code>undefined</code> | 4.17.48 |
482
+ | **`localApi`** | <code>string</code> | Configure the CLI to use a local api for testing. | <code>undefined</code> | 6.3.3 |
483
+ | **`localApiFiles`** | <code>string</code> | Configure the CLI to use a local file api for testing. | <code>undefined</code> | 6.3.3 |
484
+ | **`allowModifyUrl`** | <code>boolean</code> | Allow the plugin to modify the updateUrl, statsUrl and channelUrl dynamically from the JavaScript side. | <code>false</code> | 5.4.0 |
485
+ | **`allowHttpsToHttpRedirect`** | <code>boolean</code> | Allow the plugin to follow redirects from HTTPS to plain HTTP for its own network requests (update checks, stats, channel calls, and bundle/manifest downloads). Blocked by default so a redirect can never downgrade updater traffic to an unencrypted connection. Only enable this if your self-hosted update server or CDN must redirect to an HTTP URL. `httpsOnly` (default `true`) rejects every non-https URL and redirect hop regardless of this setting, so an HTTP redirect also needs `httpsOnly: false`. Direct HTTP URLs (for example `localApi` during development) are only allowed with `httpsOnly: false` as well. Only available for Android and iOS. | <code>false</code> | 8.52.0 |
486
+ | **`httpsOnly`** | <code>boolean</code> | Require https for every URL the plugin talks to: `updateUrl`, `statsUrl`, `channelUrl` (from config, persisted values and `setUpdateUrl` / `setStatsUrl` / `setChannelUrl`), bundle zip URLs, every manifest `download_url`, preview payload URLs and every redirect hop. When enabled it overrides `allowHttpsToHttpRedirect`. A non-https URL fails the call or download with `httpsOnly is enabled and &lt;url&gt; is not https`. Set to `false` only for local development servers (for example a plain-http `localApi` on loopback) or a self-hosted plain-http update server you control. Upgrading with a plain-http `updateUrl`, `statsUrl`, `channelUrl` or `allowHttpsToHttpRedirect: true` requires setting this to `false` explicitly. Only available for Android and iOS. | <code>true</code> | 8.54.0 |
487
+ | **`http3`** | <code>boolean</code> | Let bundle and manifest downloads use HTTP/3 when the server advertises it. Android 14+ (and Android 12 or 13 with the S extension at level 7) sends https downloads through the platform `HttpEngine`, which keeps the server's HTTP/3 support across app launches and falls back to HTTP/2 (or HTTP/1.1 when the server lacks HTTP/2) on its own when QUIC is blocked. Older Android versions keep the current OkHttp client (HTTP/2 or HTTP/1.1). iOS marks download requests as HTTP/3 capable, and URLSession falls back to HTTP/2 or HTTP/1.1 when QUIC fails or the server does not support HTTP/3. Update checks, stats and channel calls are not affected. Set to `false` to stop preferring HTTP/3. Android then keeps downloads on the previous OkHttp client (HTTP/2 or HTTP/1.1). iOS no longer marks downloads as HTTP/3 capable, but URLSession can still pick HTTP/3 on its own if it already learned the server supports it, so `false` is not a hard HTTP/2 guarantee there. Only available for Android and iOS. | <code>true</code> | 8.55.0 |
488
+ | **`builtinMinimum`** | <code>boolean</code> | Refuse to download or install a bundle whose version is lower than the native app version (`version` config override, else `CFBundleShortVersionString` / `versionName`). This is the on-device counterpart of the Capgo channel setting "disable auto update under native" and protects against a replayed old update response rolling the app back below its store version. This is not strict semver validation: both versions are read as a numeric core, ignoring whitespace and `+build` metadata, cutting the prerelease at the first `-`, and taking the leading digits of the first three dot-separated parts (missing or non-numeric parts count as `0`, extra parts are ignored). So a `1.2.3-beta.1` bundle is accepted on native `1.2.3`, `1.2.preview` is read as `1.2.0`, and native `2.0.0.4` compares as `2.0.0`. Only a version that does not start with a digit (after whitespace is removed) skips the check. Rejections are reported as the `version_below_native` stat. Set it to `false` if you version web bundles independently of the native app (for example native `2.0.0` with bundle `1.4.7`). The default was `false` before 9.0.0. Only available for Android and iOS. | <code>true</code> | 8.54.0 |
489
+ | **`allowModifyAppId`** | <code>boolean</code> | Allow the plugin to modify the appId dynamically from the JavaScript side. | <code>false</code> | 7.14.0 |
490
+ | **`allowManualBundleError`** | <code>boolean</code> | Allow marking bundles as errored from JavaScript while using manual update flows. When enabled, {@link CapacitorUpdaterPlugin.setBundleError} can change a bundle status to `error`. | <code>false</code> | 7.20.0 |
491
+ | **`allowPreview`** | <code>boolean</code> | Allow JavaScript to start a native preview session and temporarily request updates for another app id. This is intended for trusted container apps that implement Expo Go-style preview flows. Only available for Android and iOS. | <code>false</code> | 8.47.0 |
492
+ | **`persistCustomId`** | <code>boolean</code> | Persist the customId set through {@link CapacitorUpdaterPlugin.setCustomId} across app restarts. Set it to `false` to keep the customId in memory only, so it resets on every app launch. Calling `setCustomId({ customId: '' })` clears the saved value even when persistence is disabled. The default was `false` before 9.0.0. Only available for Android and iOS. | <code>true</code> | 7.17.3 |
493
+ | **`persistModifyUrl`** | <code>boolean</code> | Persist the updateUrl, statsUrl and channelUrl set through {@link CapacitorUpdaterPlugin.setUpdateUrl}, {@link CapacitorUpdaterPlugin.setStatsUrl} and {@link CapacitorUpdaterPlugin.setChannelUrl} across app restarts. Only available for Android and iOS. | <code>false</code> | 7.20.0 |
494
+ | **`allowSetDefaultChannel`** | <code>boolean</code> | Allow or disallow the {@link CapacitorUpdaterPlugin.setChannel} method to modify the defaultChannel. When set to `false`, calling `setChannel()` will return an error with code `disabled_by_config`. | <code>true</code> | 7.34.0 |
495
+ | **`persistDefaultChannelOnReinstall`** | <code>boolean</code> | Keep the default channel stored by {@link CapacitorUpdaterPlugin.setChannel} or refreshed by {@link CapacitorUpdaterPlugin.getChannel} when app data is restored into a new app install. `setChannel()` and a successful `getChannel()` still persist the selected channel across app restarts. When this option is `false`, native startup clears that persisted channel when it detects app data restored into a new installation. Native build cleanup clears the persisted channel only when `persistDefaultChannelOnReinstall` is `false`, `resetWhenUpdate` is `true`, and the native build version has changed. Only available for Android and iOS. | <code>true</code> | 8.51.0 |
496
+ | **`defaultChannel`** | <code>string</code> | Set the default channel for the app in the config. Case sensitive. This will setting will override the default channel set in the cloud, but will still respect overrides made in the cloud. This requires the channel to allow devices to self dissociate/associate in the channel settings. https://capgo.app/docs/public-api/channels/#channel-configuration-options | <code>undefined</code> | 5.5.0 |
497
+ | **`appId`** | <code>string</code> | Configure the app id for the app in the config. | <code>undefined</code> | 6.0.0 |
498
+ | **`keepUrlPathAfterReload`** | <code>boolean</code> | Configure the plugin to keep the URL path after a reload. WARNING: When a reload is triggered, 'window.history' will be cleared. | <code>false</code> | 6.8.0 |
499
+ | **`disableJSLogging`** | <code>boolean</code> | Disable the JavaScript logging of the plugin. if true, the plugin will not log to the JavaScript console. only the native log will be done | <code>false</code> | 7.3.0 |
500
+ | **`osLogging`** | <code>boolean</code> | Enable OS-level logging. When enabled, logs are written to the system log which can be inspected in production builds. - **iOS**: Uses os_log instead of Swift.print, logs accessible via Console.app or Instruments - **Android**: Logs to Logcat (android.util.Log) When set to false, system logging is disabled on both platforms (only JavaScript console logging will occur if enabled). This is useful for debugging production apps (App Store/TestFlight builds on iOS, or production APKs on Android). | <code>true</code> | 8.42.0 |
501
+ | **`shakeMenu`** | <code>boolean</code> | Enable the native preview menu gesture while a preview session is active. Outside preview sessions this preview menu is ignored, unless {@link PluginsConfig.CapacitorUpdater.allowShakeChannelSelector} is enabled. | <code>false</code> | 7.5.0 |
502
+ | **`shakeMenuGesture`** | <code><a href="#shakemenugesture">ShakeMenuGesture</a></code> | Choose which native gesture opens the preview/channel menu. This applies to both {@link PluginsConfig.CapacitorUpdater.shakeMenu} and {@link PluginsConfig.CapacitorUpdater.allowShakeChannelSelector}. Only available for Android and iOS. | <code>'shake'</code> | 8.48.0 |
503
+ | **`allowShakeChannelSelector`** | <code>boolean</code> | Enable the native menu gesture to show a channel selector menu for switching between update channels. If {@link PluginsConfig.CapacitorUpdater.shakeMenu} is also enabled while a preview session is active, the shake menu includes both preview actions and channel switching. The native gesture can be changed with {@link PluginsConfig.CapacitorUpdater.shakeMenuGesture}. Only available for Android and iOS. | <code>false</code> | 8.43.0 |
504
+ | **`nativeUpdatePrompt`** | <code>boolean</code> | When enabled, show a native dialog prompting the user to install a newer native app from the App Store or Play Store. The prompt appears when a live update is blocked because the device native app is too old, including backend `disable_auto_update_*` responses, `store_update_required`, and `breakingAvailable` flows. Only available for Android and iOS. No-op on web. | <code>false</code> | 8.53.0 |
505
+ | **`nativeUpdatePromptTitle`** | <code>string</code> | Optional title for the native store update dialog shown when {@link PluginsConfig.CapacitorUpdater.nativeUpdatePrompt} is enabled. Only available for Android and iOS. | <code>"Update available"</code> | 8.53.0 |
506
+ | **`nativeUpdatePromptMessage`** | <code>string</code> | Optional message body for the native store update dialog shown when {@link PluginsConfig.CapacitorUpdater.nativeUpdatePrompt} is enabled. Only available for Android and iOS. | <code>A short message explaining that a newer native app is available in the store.</code> | 8.53.0 |
507
+ | **`nativeUpdatePromptUpdateButton`** | <code>string</code> | Optional label for the primary action button that opens the store or starts an in-app update on Android. Only available for Android and iOS. | <code>"Update"</code> | 8.53.0 |
508
+ | **`nativeUpdatePromptLaterButton`** | <code>string</code> | Optional label for the dismiss action on the native store update dialog. Only available for Android and iOS. | <code>"Not now"</code> | 8.53.0 |
509
+ | **`nativeUpdatePromptCountry`** | <code>string</code> | Optional ISO 3166-1 alpha-2 country filter. When set, the prompt is shown only when the device region matches one of the comma-separated country codes (for example `"US"` or `"US,CA"`). Only available for Android and iOS. | <code>undefined (show in all regions)</code> | 8.53.0 |
510
+ | **`nativeUpdatePromptOnStoreCheck`** | <code>boolean</code> | When {@link PluginsConfig.CapacitorUpdater.nativeUpdatePrompt} is enabled, also show the dialog when {@link CapacitorUpdaterPlugin.getAppUpdateInfo} reports that a store update is available. Only available for Android and iOS. | <code>false</code> | 8.53.0 |
511
+ | **`nativeUpdatePromptCooldownHours`** | <code>number</code> | Minimum hours between native update prompts for the same native app version. Also limited to once per app session. Only available for Android and iOS. | <code>24</code> | 8.53.0 |
512
+
513
+ ### Examples
514
+
515
+ In `capacitor.config.json`:
516
+
517
+ ```json
518
+ {
519
+ "plugins": {
520
+ "CapacitorUpdater": {
521
+ "appReadyTimeout": 1000 // (1 second, minimum 1000),
522
+ "responseTimeout": 10 // (10 second),
523
+ "autoDeleteFailed": false,
524
+ "autoDeletePrevious": false,
525
+ "autoUpdate": "onlyDownload",
526
+ "resetWhenUpdate": false,
527
+ "updateUrl": https://example.com/api/auto_update,
528
+ "channelUrl": https://example.com/api/channel,
529
+ "statsUrl": https://example.com/api/stats,
530
+ "publicKey": undefined,
531
+ "version": undefined,
532
+ "autoSplashscreen": undefined,
533
+ "autoSplashscreenLoader": undefined,
534
+ "autoSplashscreenTimeout": undefined,
535
+ "periodCheckDelay": 3600 (1 hour),
536
+ "localS3": undefined,
537
+ "localHost": undefined,
538
+ "localWebHost": undefined,
539
+ "localSupa": undefined,
540
+ "localSupaAnon": undefined,
541
+ "localApi": undefined,
542
+ "localApiFiles": undefined,
543
+ "allowModifyUrl": undefined,
544
+ "allowHttpsToHttpRedirect": undefined,
545
+ "httpsOnly": undefined,
546
+ "http3": undefined,
547
+ "builtinMinimum": undefined,
548
+ "allowModifyAppId": undefined,
549
+ "allowManualBundleError": undefined,
550
+ "allowPreview": undefined,
551
+ "persistCustomId": undefined,
552
+ "persistModifyUrl": undefined,
553
+ "allowSetDefaultChannel": undefined,
554
+ "persistDefaultChannelOnReinstall": undefined,
555
+ "defaultChannel": undefined,
556
+ "appId": undefined,
557
+ "keepUrlPathAfterReload": undefined,
558
+ "disableJSLogging": undefined,
559
+ "osLogging": undefined,
560
+ "shakeMenu": undefined,
561
+ "shakeMenuGesture": undefined,
562
+ "allowShakeChannelSelector": undefined,
563
+ "nativeUpdatePrompt": undefined,
564
+ "nativeUpdatePromptTitle": undefined,
565
+ "nativeUpdatePromptMessage": undefined,
566
+ "nativeUpdatePromptUpdateButton": undefined,
567
+ "nativeUpdatePromptLaterButton": undefined,
568
+ "nativeUpdatePromptCountry": undefined,
569
+ "nativeUpdatePromptOnStoreCheck": undefined,
570
+ "nativeUpdatePromptCooldownHours": undefined
571
+ }
572
+ }
573
+ }
574
+ ```
575
+
576
+ In `capacitor.config.ts`:
577
+
578
+ ```ts
579
+ /// <reference types="@capgo/capacitor-updater" />
580
+
581
+ import { CapacitorConfig } from '@capacitor/cli';
582
+
583
+ const config: CapacitorConfig = {
584
+ plugins: {
585
+ CapacitorUpdater: {
586
+ appReadyTimeout: 1000 // (1 second, minimum 1000),
587
+ responseTimeout: 10 // (10 second),
588
+ autoDeleteFailed: false,
589
+ autoDeletePrevious: false,
590
+ autoUpdate: "onlyDownload",
591
+ resetWhenUpdate: false,
592
+ updateUrl: https://example.com/api/auto_update,
593
+ channelUrl: https://example.com/api/channel,
594
+ statsUrl: https://example.com/api/stats,
595
+ publicKey: undefined,
596
+ version: undefined,
597
+ autoSplashscreen: undefined,
598
+ autoSplashscreenLoader: undefined,
599
+ autoSplashscreenTimeout: undefined,
600
+ periodCheckDelay: 3600 (1 hour),
601
+ localS3: undefined,
602
+ localHost: undefined,
603
+ localWebHost: undefined,
604
+ localSupa: undefined,
605
+ localSupaAnon: undefined,
606
+ localApi: undefined,
607
+ localApiFiles: undefined,
608
+ allowModifyUrl: undefined,
609
+ allowHttpsToHttpRedirect: undefined,
610
+ httpsOnly: undefined,
611
+ http3: undefined,
612
+ builtinMinimum: undefined,
613
+ allowModifyAppId: undefined,
614
+ allowManualBundleError: undefined,
615
+ allowPreview: undefined,
616
+ persistCustomId: undefined,
617
+ persistModifyUrl: undefined,
618
+ allowSetDefaultChannel: undefined,
619
+ persistDefaultChannelOnReinstall: undefined,
620
+ defaultChannel: undefined,
621
+ appId: undefined,
622
+ keepUrlPathAfterReload: undefined,
623
+ disableJSLogging: undefined,
624
+ osLogging: undefined,
625
+ shakeMenu: undefined,
626
+ shakeMenuGesture: undefined,
627
+ allowShakeChannelSelector: undefined,
628
+ nativeUpdatePrompt: undefined,
629
+ nativeUpdatePromptTitle: undefined,
630
+ nativeUpdatePromptMessage: undefined,
631
+ nativeUpdatePromptUpdateButton: undefined,
632
+ nativeUpdatePromptLaterButton: undefined,
633
+ nativeUpdatePromptCountry: undefined,
634
+ nativeUpdatePromptOnStoreCheck: undefined,
635
+ nativeUpdatePromptCooldownHours: undefined,
636
+ },
637
+ },
638
+ };
639
+
640
+ export default config;
641
+ ```
642
+
643
+ </docgen-config>
644
+
119
645
  ## API
120
646
 
121
647
  <docgen-index>
648
+ <!--Auto-generated, compact index-->
122
649
 
123
650
  * [`notifyAppReady()`](#notifyappready)
651
+ * [`setUpdateUrl(...)`](#setupdateurl)
652
+ * [`setStatsUrl(...)`](#setstatsurl)
653
+ * [`setChannelUrl(...)`](#setchannelurl)
124
654
  * [`download(...)`](#download)
125
655
  * [`next(...)`](#next)
126
656
  * [`set(...)`](#set)
657
+ * [`startPreviewSession(...)`](#startpreviewsession)
658
+ * [`listPreviews()`](#listpreviews)
659
+ * [`setPreview(...)`](#setpreview)
660
+ * [`resetPreview()`](#resetpreview)
661
+ * [`deletePreview(...)`](#deletepreview)
662
+ * [`checkPreviewUpdate(...)`](#checkpreviewupdate)
663
+ * [`updatePreview(...)`](#updatepreview)
127
664
  * [`delete(...)`](#delete)
128
- * [`list()`](#list)
665
+ * [`setBundleError(...)`](#setbundleerror)
666
+ * [`list(...)`](#list)
129
667
  * [`reset(...)`](#reset)
130
668
  * [`current()`](#current)
131
669
  * [`reload()`](#reload)
132
670
  * [`setMultiDelay(...)`](#setmultidelay)
133
671
  * [`cancelDelay()`](#canceldelay)
134
- * [`getLatest()`](#getlatest)
672
+ * [`triggerUpdateCheck()`](#triggerupdatecheck)
673
+ * [`getLatest(...)`](#getlatest)
674
+ * [`getMissingBundleFiles(...)`](#getmissingbundlefiles)
675
+ * [`getBundleDownloadSize(...)`](#getbundledownloadsize)
135
676
  * [`setChannel(...)`](#setchannel)
677
+ * [`unsetChannel(...)`](#unsetchannel)
136
678
  * [`getChannel()`](#getchannel)
679
+ * [`listChannels()`](#listchannels)
137
680
  * [`setCustomId(...)`](#setcustomid)
138
- * [`addListener('download', ...)`](#addlistenerdownload)
139
- * [`addListener('noNeedUpdate', ...)`](#addlistenernoneedupdate)
140
- * [`addListener('updateAvailable', ...)`](#addlistenerupdateavailable)
141
- * [`addListener('downloadComplete', ...)`](#addlistenerdownloadcomplete)
142
- * [`addListener('majorAvailable', ...)`](#addlistenermajoravailable)
143
- * [`addListener('updateFailed', ...)`](#addlistenerupdatefailed)
144
- * [`addListener('downloadFailed', ...)`](#addlistenerdownloadfailed)
145
- * [`addListener('appReloaded', ...)`](#addlistenerappreloaded)
681
+ * [`getBuiltinVersion()`](#getbuiltinversion)
146
682
  * [`getDeviceId()`](#getdeviceid)
147
683
  * [`getPluginVersion()`](#getpluginversion)
148
684
  * [`isAutoUpdateEnabled()`](#isautoupdateenabled)
149
685
  * [`removeAllListeners()`](#removealllisteners)
686
+ * [`addListener('updaterEvent', ...)`](#addlistenerupdaterevent-)
687
+ * [`isAutoUpdateAvailable()`](#isautoupdateavailable)
688
+ * [`getNextBundle()`](#getnextbundle)
689
+ * [`getFailedUpdate()`](#getfailedupdate)
690
+ * [`setShakeMenu(...)`](#setshakemenu)
691
+ * [`isShakeMenuEnabled()`](#isshakemenuenabled)
692
+ * [`setShakeChannelSelector(...)`](#setshakechannelselector)
693
+ * [`isShakeChannelSelectorEnabled()`](#isshakechannelselectorenabled)
694
+ * [`getAppId()`](#getappid)
695
+ * [`setAppId(...)`](#setappid)
696
+ * [`getAppUpdateInfo(...)`](#getappupdateinfo)
697
+ * [`openAppStore(...)`](#openappstore)
698
+ * [`performImmediateUpdate()`](#performimmediateupdate)
699
+ * [`startFlexibleUpdate()`](#startflexibleupdate)
700
+ * [`completeFlexibleUpdate()`](#completeflexibleupdate)
150
701
  * [Interfaces](#interfaces)
151
702
  * [Type Aliases](#type-aliases)
703
+ * [Enums](#enums)
152
704
 
153
705
  </docgen-index>
154
706
 
155
707
  <docgen-api>
156
708
  <!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
157
709
 
158
- ### notifyAppReady()
710
+ #### notifyAppReady()
159
711
 
160
712
  ```typescript
161
- notifyAppReady() => Promise<BundleInfo>
713
+ notifyAppReady() => Promise<AppReadyResult>
162
714
  ```
163
715
 
164
- Notify Capacitor Updater that the current bundle is working (a rollback will occur of this method is not called on every app launch)
165
- By default this method should be called in the first 10 sec after app launch, otherwise a rollback will occur.
166
- Change this behaviour with {@link appReadyTimeout}
716
+ Notify the native layer that JavaScript initialized successfully.
167
717
 
168
- **Returns:** <code>Promise&lt;<a href="#bundleinfo">BundleInfo</a>&gt;</code>
718
+ **CRITICAL: You must call this method on every app launch to prevent automatic rollback.**
719
+
720
+ This is a simple notification to confirm that your bundle's JavaScript loaded and executed.
721
+ The native web server successfully served the bundle files and your JS runtime started.
722
+ That's all it checks - nothing more complex.
723
+
724
+ **What triggers rollback:**
725
+ - NOT calling this method within the timeout (default: 10 seconds)
726
+ - Complete JavaScript failure (bundle won't load at all)
727
+
728
+ **What does NOT trigger rollback:**
729
+ - Runtime errors after initialization (API failures, crashes, etc.)
730
+ - Network request failures
731
+ - Application logic errors
732
+
733
+ **IMPORTANT: Call this BEFORE any network requests.**
734
+ Don't wait for APIs, data loading, or async operations. Call it as soon as your
735
+ JavaScript bundle starts executing to confirm the bundle itself is valid.
736
+
737
+ Best practices:
738
+ - Call immediately in your app entry point (main.js, app component mount, etc.)
739
+ - Don't put it after network calls or heavy initialization
740
+ - Don't wrap it in try/catch with conditions
741
+ - Adjust {@link PluginsConfig.CapacitorUpdater.appReadyTimeout} if you need more time
742
+
743
+ **Returns:** <code>Promise&lt;<a href="#appreadyresult">AppReadyResult</a>&gt;</code>
169
744
 
170
745
  --------------------
171
746
 
172
747
 
173
- ### download(...)
748
+ #### setUpdateUrl(...)
174
749
 
175
750
  ```typescript
176
- download(options: { url: string; version: string; sessionKey?: string; checksum?: string; }) => Promise<BundleInfo>
751
+ setUpdateUrl(options: UpdateUrl) => Promise<void>
177
752
  ```
178
753
 
179
- Download a new bundle from the provided URL, it should be a zip file, with files inside or with a unique id inside with all your files
754
+ Set the update URL for the app dynamically at runtime.
180
755
 
181
- | Param | Type |
182
- | ------------- | -------------------------------------------------------------------------------------- |
183
- | **`options`** | <code>{ url: string; version: string; sessionKey?: string; checksum?: string; }</code> |
756
+ This overrides the {@link PluginsConfig.CapacitorUpdater.updateUrl} config value.
757
+ Requires {@link PluginsConfig.CapacitorUpdater.allowModifyUrl} to be set to `true`.
184
758
 
185
- **Returns:** <code>Promise&lt;<a href="#bundleinfo">BundleInfo</a>&gt;</code>
759
+ Use {@link PluginsConfig.CapacitorUpdater.persistModifyUrl} to persist this value across app restarts.
760
+ Otherwise, the URL will reset to the config value on next app launch.
761
+
762
+ | Param | Type | Description |
763
+ | ------------- | ----------------------------------------------- | ------------------------------------------------- |
764
+ | **`options`** | <code><a href="#updateurl">UpdateUrl</a></code> | Contains the URL to use for checking for updates. |
765
+
766
+ **Since:** 5.4.0
186
767
 
187
768
  --------------------
188
769
 
189
770
 
190
- ### next(...)
771
+ #### setStatsUrl(...)
191
772
 
192
773
  ```typescript
193
- next(options: { id: string; }) => Promise<BundleInfo>
774
+ setStatsUrl(options: StatsUrl) => Promise<void>
194
775
  ```
195
776
 
196
- Set the next bundle to be used when the app is reloaded.
777
+ Set the statistics URL for the app dynamically at runtime.
197
778
 
198
- | Param | Type |
199
- | ------------- | ---------------------------- |
200
- | **`options`** | <code>{ id: string; }</code> |
779
+ This overrides the {@link PluginsConfig.CapacitorUpdater.statsUrl} config value.
780
+ Requires {@link PluginsConfig.CapacitorUpdater.allowModifyUrl} to be set to `true`.
201
781
 
202
- **Returns:** <code>Promise&lt;<a href="#bundleinfo">BundleInfo</a>&gt;</code>
782
+ Pass an empty string to disable statistics gathering entirely.
783
+ Use {@link PluginsConfig.CapacitorUpdater.persistModifyUrl} to persist this value across app restarts.
784
+
785
+ | Param | Type | Description |
786
+ | ------------- | --------------------------------------------- | ------------------------------------------------------------------------------ |
787
+ | **`options`** | <code><a href="#statsurl">StatsUrl</a></code> | Contains the URL to use for sending statistics, or an empty string to disable. |
788
+
789
+ **Since:** 5.4.0
203
790
 
204
791
  --------------------
205
792
 
206
793
 
207
- ### set(...)
794
+ #### setChannelUrl(...)
208
795
 
209
796
  ```typescript
210
- set(options: { id: string; }) => Promise<void>
797
+ setChannelUrl(options: ChannelUrl) => Promise<void>
211
798
  ```
212
799
 
213
- Set the current bundle and immediately reloads the app.
800
+ Set the channel URL for the app dynamically at runtime.
801
+
802
+ This overrides the {@link PluginsConfig.CapacitorUpdater.channelUrl} config value.
803
+ Requires {@link PluginsConfig.CapacitorUpdater.allowModifyUrl} to be set to `true`.
804
+
805
+ Use {@link PluginsConfig.CapacitorUpdater.persistModifyUrl} to persist this value across app restarts.
806
+ Otherwise, the URL will reset to the config value on next app launch.
214
807
 
215
- | Param | Type |
216
- | ------------- | ---------------------------- |
217
- | **`options`** | <code>{ id: string; }</code> |
808
+ | Param | Type | Description |
809
+ | ------------- | ------------------------------------------------- | ----------------------------------------------- |
810
+ | **`options`** | <code><a href="#channelurl">ChannelUrl</a></code> | Contains the URL to use for channel operations. |
811
+
812
+ **Since:** 5.4.0
218
813
 
219
814
  --------------------
220
815
 
221
816
 
222
- ### delete(...)
817
+ #### download(...)
223
818
 
224
819
  ```typescript
225
- delete(options: { id: string; }) => Promise<void>
820
+ download(options: DownloadOptions) => Promise<BundleInfo>
226
821
  ```
227
822
 
228
- Delete bundle in storage
823
+ Download a new bundle from the provided URL for later installation.
229
824
 
230
- | Param | Type |
231
- | ------------- | ---------------------------- |
232
- | **`options`** | <code>{ id: string; }</code> |
825
+ The downloaded bundle is stored locally but not activated. To use it:
826
+ - Call {@link next} to set it for installation on next app backgrounding/restart
827
+ - Call {@link set} to activate it immediately (destroys current JavaScript context)
233
828
 
234
- --------------------
829
+ The URL should point to a zip file containing either:
830
+ - Your app files directly in the zip root, or
831
+ - A single folder containing all your app files
235
832
 
833
+ The bundle must include an `index.html` file at the root level.
236
834
 
237
- ### list()
835
+ For encrypted bundles, provide the `sessionKey` and `checksum` parameters.
836
+ For multi-file delta updates, provide the `manifest` array.
238
837
 
239
- ```typescript
240
- list() => Promise<{ bundles: BundleInfo[]; }>
241
- ```
838
+ **Android Background Runner note:** `@capacitor/background-runner` loads its
839
+ configured runner script from native APK assets. Live updates cannot replace
840
+ that runner script. Keep it stable across OTA updates and ship a native app
841
+ update when the runner code changes. When a bundle switch happens, Capacitor
842
+ Updater cancels and reschedules configured Background Runner WorkManager jobs
843
+ and syncs the bundled runner script into native `public/` storage when present.
242
844
 
243
- Get all available bundles
845
+ | Param | Type | Description |
846
+ | ------------- | ----------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
847
+ | **`options`** | <code><a href="#downloadoptions">DownloadOptions</a></code> | The {@link <a href="#downloadoptions">DownloadOptions</a>} for downloading a new bundle zip. |
244
848
 
245
- **Returns:** <code>Promise&lt;{ bundles: BundleInfo[]; }&gt;</code>
849
+ **Returns:** <code>Promise&lt;<a href="#bundleinfo">BundleInfo</a>&gt;</code>
246
850
 
247
851
  --------------------
248
852
 
249
853
 
250
- ### reset(...)
854
+ #### next(...)
251
855
 
252
856
  ```typescript
253
- reset(options?: { toLastSuccessful?: boolean | undefined; } | undefined) => Promise<void>
857
+ next(options: BundleId) => Promise<BundleInfo>
254
858
  ```
255
859
 
256
- Set the `builtin` bundle (the one sent to Apple store / Google play store ) as current bundle
860
+ Set the next bundle to be activated when the app backgrounds or restarts.
861
+
862
+ This is the recommended way to apply updates as it doesn't interrupt the user's current session.
863
+ The bundle will be activated when:
864
+ - The app is backgrounded (user switches away), or
865
+ - The app is killed and relaunched, or
866
+ - {@link reload} is called manually
867
+
868
+ Unlike {@link set}, this method does NOT destroy the current JavaScript context immediately.
869
+ Your app continues running normally until one of the above events occurs.
870
+
871
+ Use {@link setMultiDelay} to add additional conditions before the update is applied.
257
872
 
258
- | Param | Type |
259
- | ------------- | -------------------------------------------- |
260
- | **`options`** | <code>{ toLastSuccessful?: boolean; }</code> |
873
+ | Param | Type | Description |
874
+ | ------------- | --------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
875
+ | **`options`** | <code><a href="#bundleid">BundleId</a></code> | Contains the ID of the bundle to set as next. Use {@link <a href="#bundleinfo">BundleInfo.id</a>} from a downloaded bundle. |
876
+
877
+ **Returns:** <code>Promise&lt;<a href="#bundleinfo">BundleInfo</a>&gt;</code>
261
878
 
262
879
  --------------------
263
880
 
264
881
 
265
- ### current()
882
+ #### set(...)
266
883
 
267
884
  ```typescript
268
- current() => Promise<{ bundle: BundleInfo; native: string; }>
885
+ set(options: BundleId) => Promise<void>
269
886
  ```
270
887
 
271
- Get the current bundle, if none are set it returns `builtin`, currentNative is the original bundle installed on the device
888
+ Set the current bundle and immediately reloads the app.
889
+
890
+ **IMPORTANT: This is a terminal operation that destroys the current JavaScript context.**
272
891
 
273
- **Returns:** <code>Promise&lt;{ bundle: <a href="#bundleinfo">BundleInfo</a>; native: string; }&gt;</code>
892
+ When you call this method:
893
+ - The entire JavaScript context is immediately destroyed
894
+ - The app reloads from a different folder with different files
895
+ - NO code after this call will execute
896
+ - NO promises will resolve
897
+ - NO callbacks will fire
898
+ - Event listeners registered after this call are unreliable and may never fire
899
+
900
+ The reload happens automatically - you don't need to do anything else.
901
+ If you need to preserve state like the current URL path, use the {@link PluginsConfig.CapacitorUpdater.keepUrlPathAfterReload} config option.
902
+ For other state preservation needs, save your data before calling this method (e.g., to localStorage).
903
+
904
+ **Do not** try to execute additional logic after calling `set()` - it won't work as expected.
905
+
906
+ | Param | Type | Description |
907
+ | ------------- | --------------------------------------------- | ------------------------------------------------------------------------------------------------- |
908
+ | **`options`** | <code><a href="#bundleid">BundleId</a></code> | A {@link <a href="#bundleid">BundleId</a>} object containing the new bundle id to set as current. |
274
909
 
275
910
  --------------------
276
911
 
277
912
 
278
- ### reload()
913
+ #### startPreviewSession(...)
279
914
 
280
915
  ```typescript
281
- reload() => Promise<void>
916
+ startPreviewSession(options?: StartPreviewSessionOptions | undefined) => Promise<void>
282
917
  ```
283
918
 
284
- Reload the view
919
+ Start a temporary preview/testing session.
920
+
921
+ This stores the currently active bundle as the pending fallback, enables the
922
+ native shake menu, and makes the next applied bundle show a native notice
923
+ explaining that shaking the device can reload or leave the preview.
924
+ Requires {@link PluginsConfig.CapacitorUpdater.allowPreview} to be `true`.
925
+ When `appId` is provided, the preview session temporarily uses that app id
926
+ for update checks until the user leaves the preview. Native updater stats are
927
+ skipped while the preview session is active.
928
+
929
+ Use this before calling {@link set} for Expo Go-style preview flows.
930
+ Use {@link listPreviews}, {@link setPreview}, {@link resetPreview},
931
+ {@link deletePreview}, {@link checkPreviewUpdate}, and
932
+ {@link updatePreview} to manage saved local previews.
933
+
934
+ | Param | Type | Description |
935
+ | ------------- | --------------------------------------------------------------------------------- | --------------------------------- |
936
+ | **`options`** | <code><a href="#startpreviewsessionoptions">StartPreviewSessionOptions</a></code> | Optional preview session options. |
937
+
938
+ **Since:** 8.47.0
285
939
 
286
940
  --------------------
287
941
 
288
942
 
289
- ### setMultiDelay(...)
943
+ #### listPreviews()
290
944
 
291
945
  ```typescript
292
- setMultiDelay(options: { delayConditions: DelayCondition[]; }) => Promise<void>
946
+ listPreviews() => Promise<PreviewListResult>
293
947
  ```
294
948
 
295
- Set <a href="#delaycondition">DelayCondition</a>, skip updates until one of the conditions is met
949
+ Get every locally available preview bundle that was registered by
950
+ {@link startPreviewSession} and later applied with {@link set}.
296
951
 
297
- | Param | Type | Description |
298
- | ------------- | --------------------------------------------------- | ------------------------------------------------------------------------ |
299
- | **`options`** | <code>{ delayConditions: DelayCondition[]; }</code> | are the {@link <a href="#delaycondition">DelayCondition</a>} list to set |
952
+ This only returns previews whose bundles are still available locally. It is
953
+ safe to show this in a preview switcher or native debug menu.
300
954
 
301
- **Since:** 4.3.0
955
+ **Returns:** <code>Promise&lt;<a href="#previewlistresult">PreviewListResult</a>&gt;</code>
956
+
957
+ **Since:** 8.49.0
302
958
 
303
959
  --------------------
304
960
 
305
961
 
306
- ### cancelDelay()
962
+ #### setPreview(...)
307
963
 
308
964
  ```typescript
309
- cancelDelay() => Promise<void>
965
+ setPreview(options: BundleId) => Promise<void>
310
966
  ```
311
967
 
312
- Cancel delay to updates as usual
968
+ Switch to a locally available preview bundle and reload the WebView.
313
969
 
314
- **Since:** 4.0.0
970
+ If the app is not already in a preview session, the current live bundle is
971
+ saved as the fallback so {@link resetPreview} or the native shake menu can
972
+ return to it later.
973
+
974
+ | Param | Type | Description |
975
+ | ------------- | --------------------------------------------- | ----------------------------------------------------------------------------------- |
976
+ | **`options`** | <code><a href="#bundleid">BundleId</a></code> | A {@link <a href="#bundleid">BundleId</a>} object containing the preview bundle ID. |
977
+
978
+ **Since:** 8.49.0
315
979
 
316
980
  --------------------
317
981
 
318
982
 
319
- ### getLatest()
983
+ #### resetPreview()
320
984
 
321
985
  ```typescript
322
- getLatest() => Promise<latestVersion>
986
+ resetPreview() => Promise<void>
323
987
  ```
324
988
 
325
- Get Latest bundle available from update Url
989
+ Leave the active preview session and reload the saved live bundle.
326
990
 
327
- **Returns:** <code>Promise&lt;<a href="#latestversion">latestVersion</a>&gt;</code>
991
+ This does not delete any saved previews. Use {@link deletePreview} to remove
992
+ a preview from local storage.
328
993
 
329
- **Since:** 4.0.0
994
+ **Since:** 8.49.0
330
995
 
331
996
  --------------------
332
997
 
333
998
 
334
- ### setChannel(...)
999
+ #### deletePreview(...)
335
1000
 
336
1001
  ```typescript
337
- setChannel(options: SetChannelOptions) => Promise<channelRes>
1002
+ deletePreview(options: BundleId) => Promise<DeletePreviewResult>
338
1003
  ```
339
1004
 
340
- Set Channel for this device
1005
+ Delete a locally saved preview and its bundle when possible.
341
1006
 
342
- | Param | Type | Description |
343
- | ------------- | --------------------------------------------------------------- | -------------------------------------------------------------------------------- |
344
- | **`options`** | <code><a href="#setchanneloptions">SetChannelOptions</a></code> | is the {@link <a href="#setchanneloptions">SetChannelOptions</a>} channel to set |
1007
+ Active previews cannot be deleted until you switch away from them or call
1008
+ {@link resetPreview}. If only the preview metadata can be removed, the
1009
+ method still resolves with `deleted: false`.
345
1010
 
346
- **Returns:** <code>Promise&lt;<a href="#channelres">channelRes</a>&gt;</code>
1011
+ | Param | Type | Description |
1012
+ | ------------- | --------------------------------------------- | ----------------------------------------------------------------------------------- |
1013
+ | **`options`** | <code><a href="#bundleid">BundleId</a></code> | A {@link <a href="#bundleid">BundleId</a>} object containing the preview bundle ID. |
347
1014
 
348
- **Since:** 4.7.0
1015
+ **Returns:** <code>Promise&lt;<a href="#deletepreviewresult">DeletePreviewResult</a>&gt;</code>
1016
+
1017
+ **Since:** 8.49.0
349
1018
 
350
1019
  --------------------
351
1020
 
352
1021
 
353
- ### getChannel()
1022
+ #### checkPreviewUpdate(...)
354
1023
 
355
1024
  ```typescript
356
- getChannel() => Promise<getChannelRes>
1025
+ checkPreviewUpdate(options: BundleId) => Promise<PreviewUpdateResult>
357
1026
  ```
358
1027
 
359
- get Channel for this device
1028
+ Check whether a saved preview's payload URL points to a newer preview bundle.
360
1029
 
361
- **Returns:** <code>Promise&lt;<a href="#getchannelres">getChannelRes</a>&gt;</code>
1030
+ Only previews started with a `payloadUrl` can be checked natively. Direct URL
1031
+ previews can still be switched or deleted locally, but the updater does not
1032
+ know where to check for newer versions.
362
1033
 
363
- **Since:** 4.8.0
1034
+ | Param | Type | Description |
1035
+ | ------------- | --------------------------------------------- | ----------------------------------------------------------------------------------- |
1036
+ | **`options`** | <code><a href="#bundleid">BundleId</a></code> | A {@link <a href="#bundleid">BundleId</a>} object containing the preview bundle ID. |
1037
+
1038
+ **Returns:** <code>Promise&lt;<a href="#previewupdateresult">PreviewUpdateResult</a>&gt;</code>
1039
+
1040
+ **Since:** 8.49.0
364
1041
 
365
1042
  --------------------
366
1043
 
367
1044
 
368
- ### setCustomId(...)
1045
+ #### updatePreview(...)
369
1046
 
370
1047
  ```typescript
371
- setCustomId(options: SetCustomIdOptions) => Promise<void>
1048
+ updatePreview(options: BundleId) => Promise<PreviewUpdateResult>
372
1049
  ```
373
1050
 
374
- Set Channel for this device
1051
+ Download the newest bundle for a saved preview payload URL.
375
1052
 
376
- | Param | Type | Description |
377
- | ------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------------------------- |
378
- | **`options`** | <code><a href="#setcustomidoptions">SetCustomIdOptions</a></code> | is the {@link <a href="#setcustomidoptions">SetCustomIdOptions</a>} customId to set |
1053
+ If the preview being updated is active, the new bundle is applied and the
1054
+ WebView reloads. Otherwise, the saved preview entry is moved to the newly
1055
+ downloaded bundle and can be selected later with {@link setPreview}.
379
1056
 
380
- **Since:** 4.9.0
1057
+ | Param | Type | Description |
1058
+ | ------------- | --------------------------------------------- | ----------------------------------------------------------------------------------- |
1059
+ | **`options`** | <code><a href="#bundleid">BundleId</a></code> | A {@link <a href="#bundleid">BundleId</a>} object containing the preview bundle ID. |
1060
+
1061
+ **Returns:** <code>Promise&lt;<a href="#previewupdateresult">PreviewUpdateResult</a>&gt;</code>
1062
+
1063
+ **Since:** 8.49.0
381
1064
 
382
1065
  --------------------
383
1066
 
384
1067
 
385
- ### addListener('download', ...)
1068
+ #### delete(...)
386
1069
 
387
1070
  ```typescript
388
- addListener(eventName: "download", listenerFunc: DownloadChangeListener) => Promise<PluginListenerHandle> & PluginListenerHandle
1071
+ delete(options: BundleId) => Promise<void>
389
1072
  ```
390
1073
 
391
- Listen for download event in the App, let you know when the download is started, loading and finished
1074
+ Delete a bundle from local storage to free up disk space.
392
1075
 
393
- | Param | Type |
394
- | ------------------ | ------------------------------------------------------------------------- |
395
- | **`eventName`** | <code>'download'</code> |
396
- | **`listenerFunc`** | <code><a href="#downloadchangelistener">DownloadChangeListener</a></code> |
1076
+ You cannot delete:
1077
+ - The currently active bundle
1078
+ - The `builtin` bundle (the version shipped with your app)
1079
+ - The bundle set as `next` (call {@link next} with a different bundle first)
397
1080
 
398
- **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt; & <a href="#pluginlistenerhandle">PluginListenerHandle</a></code>
1081
+ Use {@link list} to get all available bundle IDs.
399
1082
 
400
- **Since:** 2.0.11
1083
+ **Note:** The bundle ID is NOT the same as the version name.
1084
+ Use the `id` field from {@link <a href="#bundleinfo">BundleInfo</a>}, not the `version` field.
1085
+
1086
+ | Param | Type | Description |
1087
+ | ------------- | --------------------------------------------- | ------------------------------------------------------------------------------------- |
1088
+ | **`options`** | <code><a href="#bundleid">BundleId</a></code> | A {@link <a href="#bundleid">BundleId</a>} object containing the bundle ID to delete. |
401
1089
 
402
1090
  --------------------
403
1091
 
404
1092
 
405
- ### addListener('noNeedUpdate', ...)
1093
+ #### setBundleError(...)
406
1094
 
407
1095
  ```typescript
408
- addListener(eventName: "noNeedUpdate", listenerFunc: NoNeedListener) => Promise<PluginListenerHandle> & PluginListenerHandle
1096
+ setBundleError(options: BundleId) => Promise<BundleInfo>
409
1097
  ```
410
1098
 
411
- Listen for no need to update event, usefull when you want force check every time the app is launched
1099
+ Manually mark a bundle as failed/errored in manual update mode.
412
1100
 
413
- | Param | Type |
414
- | ------------------ | --------------------------------------------------------- |
415
- | **`eventName`** | <code>'noNeedUpdate'</code> |
416
- | **`listenerFunc`** | <code><a href="#noneedlistener">NoNeedListener</a></code> |
1101
+ This is useful when you detect that a bundle has critical issues and want to prevent
1102
+ it from being used again. The bundle status will be changed to `error` and the plugin
1103
+ will avoid using this bundle in the future.
417
1104
 
418
- **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt; & <a href="#pluginlistenerhandle">PluginListenerHandle</a></code>
1105
+ **Requirements:**
1106
+ - {@link PluginsConfig.CapacitorUpdater.allowManualBundleError} must be set to `true`
1107
+ - Only works in manual update mode (when autoUpdate is disabled)
419
1108
 
420
- **Since:** 4.0.0
1109
+ Common use case: After downloading and testing a bundle, you discover it has critical
1110
+ bugs and want to mark it as failed so it won't be retried.
1111
+
1112
+ | Param | Type | Description |
1113
+ | ------------- | --------------------------------------------- | ---------------------------------------------------------------------------------------------- |
1114
+ | **`options`** | <code><a href="#bundleid">BundleId</a></code> | A {@link <a href="#bundleid">BundleId</a>} object containing the bundle ID to mark as errored. |
1115
+
1116
+ **Returns:** <code>Promise&lt;<a href="#bundleinfo">BundleInfo</a>&gt;</code>
1117
+
1118
+ **Since:** 7.20.0
421
1119
 
422
1120
  --------------------
423
1121
 
424
1122
 
425
- ### addListener('updateAvailable', ...)
1123
+ #### list(...)
426
1124
 
427
1125
  ```typescript
428
- addListener(eventName: "updateAvailable", listenerFunc: UpdateAvailabledListener) => Promise<PluginListenerHandle> & PluginListenerHandle
1126
+ list(options?: ListOptions | undefined) => Promise<BundleListResult>
429
1127
  ```
430
1128
 
431
- Listen for availbale update event, usefull when you want to force check every time the app is launched
1129
+ Get all locally downloaded bundles stored in your app.
432
1130
 
433
- | Param | Type |
434
- | ------------------ | ----------------------------------------------------------------------------- |
435
- | **`eventName`** | <code>'updateAvailable'</code> |
436
- | **`listenerFunc`** | <code><a href="#updateavailabledlistener">UpdateAvailabledListener</a></code> |
1131
+ This returns all bundles that have been downloaded and are available locally, including:
1132
+ - The currently active bundle
1133
+ - The `builtin` bundle (shipped with your app)
1134
+ - Any downloaded bundles waiting to be activated
1135
+ - Failed bundles (with `error` status)
437
1136
 
438
- **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt; & <a href="#pluginlistenerhandle">PluginListenerHandle</a></code>
1137
+ Use this to:
1138
+ - Check available disk space by counting bundles
1139
+ - Delete old bundles with {@link delete}
1140
+ - Monitor bundle download status
439
1141
 
440
- **Since:** 4.0.0
1142
+ | Param | Type | Description |
1143
+ | ------------- | --------------------------------------------------- | ------------------------------------------------------------------------------------------ |
1144
+ | **`options`** | <code><a href="#listoptions">ListOptions</a></code> | The {@link <a href="#listoptions">ListOptions</a>} for customizing the bundle list output. |
1145
+
1146
+ **Returns:** <code>Promise&lt;<a href="#bundlelistresult">BundleListResult</a>&gt;</code>
441
1147
 
442
1148
  --------------------
443
1149
 
444
1150
 
445
- ### addListener('downloadComplete', ...)
1151
+ #### reset(...)
446
1152
 
447
1153
  ```typescript
448
- addListener(eventName: "downloadComplete", listenerFunc: DownloadCompleteListener) => Promise<PluginListenerHandle> & PluginListenerHandle
1154
+ reset(options?: ResetOptions | undefined) => Promise<void>
449
1155
  ```
450
1156
 
451
- Listen for download event in the App, let you know when the download is started, loading and finished
1157
+ Reset the app to a known good bundle.
452
1158
 
453
- | Param | Type |
454
- | ------------------ | ----------------------------------------------------------------------------- |
455
- | **`eventName`** | <code>'downloadComplete'</code> |
456
- | **`listenerFunc`** | <code><a href="#downloadcompletelistener">DownloadCompleteListener</a></code> |
1159
+ This method helps recover from problematic updates by reverting to either:
1160
+ - The `builtin` bundle (the original version shipped with your app to App Store/Play Store)
1161
+ - The last successfully loaded bundle (most recent bundle that worked correctly)
457
1162
 
458
- **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt; & <a href="#pluginlistenerhandle">PluginListenerHandle</a></code>
1163
+ **IMPORTANT: This triggers an immediate app reload, destroying the current JavaScript context.**
1164
+ See {@link set} for details on the implications of this operation.
459
1165
 
460
- **Since:** 4.0.0
1166
+ Use cases:
1167
+ - Emergency recovery when an update causes critical issues
1168
+ - Testing rollback functionality
1169
+ - Providing users a "reset to factory" option
1170
+
1171
+ | Param | Type |
1172
+ | ------------- | ----------------------------------------------------- |
1173
+ | **`options`** | <code><a href="#resetoptions">ResetOptions</a></code> |
461
1174
 
462
1175
  --------------------
463
1176
 
464
1177
 
465
- ### addListener('majorAvailable', ...)
1178
+ #### current()
466
1179
 
467
1180
  ```typescript
468
- addListener(eventName: "majorAvailable", listenerFunc: MajorAvailableListener) => Promise<PluginListenerHandle> & PluginListenerHandle
1181
+ current() => Promise<CurrentBundleResult>
469
1182
  ```
470
1183
 
471
- Listen for Major update event in the App, let you know when major update is blocked by setting disableAutoUpdateBreaking
1184
+ Get information about the currently active bundle.
472
1185
 
473
- | Param | Type |
474
- | ------------------ | ------------------------------------------------------------------------- |
475
- | **`eventName`** | <code>'majorAvailable'</code> |
476
- | **`listenerFunc`** | <code><a href="#majoravailablelistener">MajorAvailableListener</a></code> |
1186
+ Returns:
1187
+ - `bundle`: The currently active bundle information
1188
+ - `native`: The version of the builtin bundle (the original app version from App/Play Store)
477
1189
 
478
- **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt; & <a href="#pluginlistenerhandle">PluginListenerHandle</a></code>
1190
+ If no updates have been applied, `bundle.id` will be `"builtin"`, indicating the app
1191
+ is running the original version shipped with the native app.
479
1192
 
480
- **Since:** 2.3.0
1193
+ Use this to:
1194
+ - Display the current version to users
1195
+ - Check if an update is currently active
1196
+ - Compare against available updates
1197
+ - Log the active bundle for debugging
1198
+
1199
+ **Returns:** <code>Promise&lt;<a href="#currentbundleresult">CurrentBundleResult</a>&gt;</code>
481
1200
 
482
1201
  --------------------
483
1202
 
484
1203
 
485
- ### addListener('updateFailed', ...)
1204
+ #### reload()
486
1205
 
487
1206
  ```typescript
488
- addListener(eventName: "updateFailed", listenerFunc: UpdateFailedListener) => Promise<PluginListenerHandle> & PluginListenerHandle
1207
+ reload() => Promise<void>
489
1208
  ```
490
1209
 
491
- Listen for update fail event in the App, let you know when update has fail to install at next app start
1210
+ Manually reload the app to apply a pending update.
492
1211
 
493
- | Param | Type |
494
- | ------------------ | --------------------------------------------------------------------- |
495
- | **`eventName`** | <code>'updateFailed'</code> |
496
- | **`listenerFunc`** | <code><a href="#updatefailedlistener">UpdateFailedListener</a></code> |
1212
+ This triggers the same reload behavior that happens automatically when the app backgrounds.
1213
+ If you've called {@link next} to queue an update, calling `reload()` will apply it immediately.
497
1214
 
498
- **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt; & <a href="#pluginlistenerhandle">PluginListenerHandle</a></code>
1215
+ **IMPORTANT: This destroys the current JavaScript context immediately.**
1216
+ See {@link set} for details on the implications of this operation.
499
1217
 
500
- **Since:** 2.3.0
1218
+ Common use cases:
1219
+ - Applying an update immediately after download instead of waiting for backgrounding
1220
+ - Providing a "Restart now" button to users after an update is ready
1221
+ - Testing update flows during development
1222
+
1223
+ If no update is pending (no call to {@link next}), this simply reloads the current bundle.
1224
+ If `builtinMinimum` rejects a pending bundle below the native version, the promise rejects with
1225
+ code `VERSION_BELOW_NATIVE` and a message naming both versions. The current bundle and pending
1226
+ update remain unchanged, so you can reset to builtin or choose another bundle.
501
1227
 
502
1228
  --------------------
503
1229
 
504
1230
 
505
- ### addListener('downloadFailed', ...)
1231
+ #### setMultiDelay(...)
506
1232
 
507
1233
  ```typescript
508
- addListener(eventName: "downloadFailed", listenerFunc: DownloadFailedListener) => Promise<PluginListenerHandle> & PluginListenerHandle
1234
+ setMultiDelay(options: MultiDelayConditions) => Promise<void>
509
1235
  ```
510
1236
 
511
- Listen for download fail event in the App, let you know when download has fail finished
1237
+ Configure conditions that must be met before a pending update is applied.
512
1238
 
513
- | Param | Type |
514
- | ------------------ | ------------------------------------------------------------------------- |
515
- | **`eventName`** | <code>'downloadFailed'</code> |
516
- | **`listenerFunc`** | <code><a href="#downloadfailedlistener">DownloadFailedListener</a></code> |
1239
+ After calling {@link next} to queue an update, use this method to control when it gets applied.
1240
+ By default, the update is installed only after **all** specified conditions are satisfied (`conditionMode: 'and'`).
1241
+ Set `conditionMode` to `'or'` to apply the update as soon as **any** condition is met.
517
1242
 
518
- **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt; & <a href="#pluginlistenerhandle">PluginListenerHandle</a></code>
1243
+ Available condition types:
1244
+ - `background`: Wait until the app has spent more than the configured time in the background (see value formats below).
1245
+ - `kill`: The condition clears on the next launch and can also clear during Android activity destruction; activity destruction does not prove that the app process ended. Automatic installation waits for the next background, because it runs from appMovedToBackground. Calling {@link reload} can apply the pending bundle immediately.
1246
+ - `date`: Wait until a specific date/time (ISO 8601 format)
1247
+ - `nativeVersion`: Wait until the native app is updated to a specific version
519
1248
 
520
- **Since:** 4.0.0
1249
+ Condition value formats:
1250
+ - `background`: Time in milliseconds in background must exceed this value before the condition can clear on return to foreground (e.g., `"300000"` for more than 5 minutes; exactly `300000` ms does not clear). Omit `value` or use `"0"` to clear after one background-and-return cycle; the update installs on the following background.
1251
+ - `kill`: No value needed
1252
+ - `date`: ISO 8601 date string (e.g., `"2025-12-31T23:59:59Z"`)
1253
+ - `nativeVersion`: Version string (e.g., `"2.0.0"`)
1254
+
1255
+ | Param | Type | Description |
1256
+ | ------------- | --------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
1257
+ | **`options`** | <code><a href="#multidelayconditions">MultiDelayConditions</a></code> | Contains the {@link <a href="#multidelayconditions">MultiDelayConditions</a>} array of conditions. |
1258
+
1259
+ **Since:** 4.3.0
521
1260
 
522
1261
  --------------------
523
1262
 
524
1263
 
525
- ### addListener('appReloaded', ...)
1264
+ #### cancelDelay()
526
1265
 
527
1266
  ```typescript
528
- addListener(eventName: "appReloaded", listenerFunc: AppReloadedListener) => Promise<PluginListenerHandle> & PluginListenerHandle
1267
+ cancelDelay() => Promise<void>
529
1268
  ```
530
1269
 
531
- Listen for download fail event in the App, let you know when download has fail finished
1270
+ Cancel all delay conditions and apply the pending update immediately.
532
1271
 
533
- | Param | Type |
534
- | ------------------ | ------------------------------------------------------------------- |
535
- | **`eventName`** | <code>'appReloaded'</code> |
536
- | **`listenerFunc`** | <code><a href="#appreloadedlistener">AppReloadedListener</a></code> |
1272
+ If you've set delay conditions with {@link setMultiDelay}, this method clears them
1273
+ and triggers the pending update to be applied on the next app background or restart.
537
1274
 
538
- **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt; & <a href="#pluginlistenerhandle">PluginListenerHandle</a></code>
1275
+ This is useful when:
1276
+ - User manually requests to update now (e.g., clicks "Update now" button)
1277
+ - Your app detects it's a good time to update (e.g., user finished critical task)
1278
+ - You want to override a time-based delay early
539
1279
 
540
- **Since:** 4.3.0
1280
+ **Since:** 4.0.0
541
1281
 
542
1282
  --------------------
543
1283
 
544
1284
 
545
- ### getDeviceId()
1285
+ #### triggerUpdateCheck()
546
1286
 
547
1287
  ```typescript
548
- getDeviceId() => Promise<{ deviceId: string; }>
1288
+ triggerUpdateCheck() => Promise<TriggerUpdateCheckResult>
549
1289
  ```
550
1290
 
551
- Get unique ID used to identify device (sent to auto update server)
1291
+ Trigger the native auto-update check/download pipeline immediately.
1292
+
1293
+ This starts the same background update flow used when the app moves to the
1294
+ foreground with auto-update enabled. It is useful for native integrations
1295
+ such as a silent push notification asking the app to check for a Capgo
1296
+ bundle without reimplementing the update protocol in JavaScript.
1297
+
1298
+ The promise resolves after the native background work has been queued, not
1299
+ after the update has been downloaded or installed. Listen to `updaterEvent`:
1300
+ its `updateCheckResult` type reports classified responses (`kind` with the
1301
+ backend error or message), including blocked and up-to-date results, which
1302
+ both emit `noNeedUpdate`. A successful offer of a new bundle is not always
1303
+ classified: it can go straight to `download` and `updateAvailable` events
1304
+ without an `updateCheckResult`, so do not wait for one after every check.
1305
+ Use `updateAvailable`, `downloadComplete`, `downloadFailed`, and
1306
+ `noNeedUpdate` for download and activation progress.
552
1307
 
553
- **Returns:** <code>Promise&lt;{ deviceId: string; }&gt;</code>
1308
+ Native support is available on iOS and Android. On Web, this method returns
1309
+ a result with `status: 'unavailable'`. Native platforms also return
1310
+ `unavailable` when the native auto-update system is disabled.
1311
+
1312
+ **Returns:** <code>Promise&lt;<a href="#triggerupdatecheckresult">TriggerUpdateCheckResult</a>&gt;</code>
554
1313
 
555
1314
  --------------------
556
1315
 
557
1316
 
558
- ### getPluginVersion()
1317
+ #### getLatest(...)
559
1318
 
560
1319
  ```typescript
561
- getPluginVersion() => Promise<{ version: string; }>
1320
+ getLatest(options?: GetLatestOptions | undefined) => Promise<LatestVersion>
562
1321
  ```
563
1322
 
564
- Get the native Capacitor Updater plugin version (sent to auto update server)
1323
+ Check the update server for the latest available bundle version.
565
1324
 
566
- **Returns:** <code>Promise&lt;{ version: string; }&gt;</code>
1325
+ This queries your configured update URL (or Capgo backend) to see if a newer bundle
1326
+ is available for download. It does NOT download the bundle automatically.
567
1327
 
568
- --------------------
1328
+ The response includes:
1329
+ - `version`: The latest available version identifier
1330
+ - `url`: Download URL for the bundle (if available)
1331
+ - `breaking`: Whether this update is marked as incompatible (requires native app update)
1332
+ - `message`: Optional message from the server
1333
+ - `manifest`: File list for delta updates (if using multi-file downloads)
1334
+
1335
+ After receiving the latest version info, you can:
1336
+ 1. Compare it with your current version
1337
+ 2. Download it using {@link download}
1338
+ 3. Apply it using {@link next} or {@link set}
1339
+
1340
+ **Important: Handling "no new version available"**
569
1341
 
1342
+ When the device's current version matches the latest version on the server (i.e., the device is already
1343
+ up-to-date), the server returns a 200 response with `error: "no_new_version_available"` and
1344
+ `message: "No new version available"`. This is a normal, expected condition and resolves with
1345
+ `kind: "up_to_date"` when the backend provides that classification.
570
1346
 
571
- ### isAutoUpdateEnabled()
1347
+ You should check `kind` and `error` before attempting to download:
572
1348
 
573
1349
  ```typescript
574
- isAutoUpdateEnabled() => Promise<{ enabled: boolean; }>
1350
+ const latest = await CapacitorUpdater.getLatest();
1351
+ if (latest.kind === 'up_to_date') {
1352
+ console.log('Already up to date');
1353
+ } else if (latest.kind === 'blocked') {
1354
+ console.log('Update is blocked:', latest.error);
1355
+ } else if (latest.url) {
1356
+ // New version is available, proceed with download
1357
+ }
575
1358
  ```
576
1359
 
577
- Get the state of auto update config. This will return `false` in manual mode.
1360
+ In this scenario, the server:
1361
+ - Logs the request with a "No new version available" message
1362
+ - Sends a "noNew" stat action to track that the device checked for updates but was already current (done on the backend)
1363
+
1364
+ | Param | Type | Description |
1365
+ | ------------- | ------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
1366
+ | **`options`** | <code><a href="#getlatestoptions">GetLatestOptions</a></code> | Optional {@link <a href="#getlatestoptions">GetLatestOptions</a>} to specify which channel to check. |
578
1367
 
579
- **Returns:** <code>Promise&lt;{ enabled: boolean; }&gt;</code>
1368
+ **Returns:** <code>Promise&lt;<a href="#latestversion">LatestVersion</a>&gt;</code>
1369
+
1370
+ **Since:** 4.0.0
580
1371
 
581
1372
  --------------------
582
1373
 
583
1374
 
584
- ### removeAllListeners()
1375
+ #### getMissingBundleFiles(...)
585
1376
 
586
1377
  ```typescript
587
- removeAllListeners() => Promise<void>
1378
+ getMissingBundleFiles(options: GetMissingBundleFilesOptions) => Promise<GetMissingBundleFilesResult>
588
1379
  ```
589
1380
 
590
- Remove all listeners for this plugin.
1381
+ Return the manifest entries that still need to be downloaded for a partial update.
591
1382
 
592
- **Since:** 1.0.0
1383
+ Pass the result from {@link getLatest} directly when it includes a `manifest`.
1384
+ The native plugin compares each manifest entry with the files already available
1385
+ in the builtin bundle and the local delta cache. Entries that can be reused are
1386
+ omitted from the returned `missing` list.
593
1387
 
594
- --------------------
1388
+ For encrypted manifests, pass the `sessionKey` returned by {@link getLatest} so
1389
+ encrypted file hashes can be checked against local files.
595
1390
 
1391
+ ```typescript
1392
+ const latest = await CapacitorUpdater.getLatest();
1393
+ const missing = await CapacitorUpdater.getMissingBundleFiles(latest);
1394
+ ```
596
1395
 
597
- ### Interfaces
1396
+ | Param | Type | Description |
1397
+ | ------------- | ------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1398
+ | **`options`** | <code><a href="#getmissingbundlefilesoptions">GetMissingBundleFilesOptions</a></code> | A {@link <a href="#getmissingbundlefilesoptions">GetMissingBundleFilesOptions</a>} object, or a {@link <a href="#latestversion">LatestVersion</a>} response containing `manifest`. |
598
1399
 
1400
+ **Returns:** <code>Promise&lt;<a href="#getmissingbundlefilesresult">GetMissingBundleFilesResult</a>&gt;</code>
599
1401
 
600
- #### BundleInfo
1402
+ **Since:** 8.47.0
601
1403
 
602
- | Prop | Type |
603
- | ---------------- | ----------------------------------------------------- |
604
- | **`id`** | <code>string</code> |
605
- | **`version`** | <code>string</code> |
606
- | **`downloaded`** | <code>string</code> |
607
- | **`checksum`** | <code>string</code> |
608
- | **`status`** | <code><a href="#bundlestatus">BundleStatus</a></code> |
1404
+ --------------------
609
1405
 
610
1406
 
611
- #### DelayCondition
1407
+ #### getBundleDownloadSize(...)
612
1408
 
613
- | Prop | Type | Description |
614
- | ----------- | --------------------------------------------------------- | ---------------------------------------- |
615
- | **`kind`** | <code><a href="#delayuntilnext">DelayUntilNext</a></code> | Set up delay conditions in setMultiDelay |
616
- | **`value`** | <code>string</code> | |
1409
+ ```typescript
1410
+ getBundleDownloadSize(options: GetBundleDownloadSizeOptions) => Promise<GetBundleDownloadSizeResult>
1411
+ ```
617
1412
 
1413
+ Estimate the download size for manifest entries before downloading them.
618
1414
 
619
- #### latestVersion
1415
+ This method sends the provided manifest entries to the Capgo update endpoint
1416
+ once and reads the stored manifest `file_size` metadata. It does not perform
1417
+ per-file `HEAD` requests from the app.
620
1418
 
621
- | Prop | Type | Description | Since |
622
- | ---------------- | -------------------- | ----------------------- | ----- |
623
- | **`version`** | <code>string</code> | Res of getLatest method | 4.0.0 |
624
- | **`major`** | <code>boolean</code> | | |
625
- | **`message`** | <code>string</code> | | |
626
- | **`sessionKey`** | <code>string</code> | | |
627
- | **`error`** | <code>string</code> | | |
628
- | **`old`** | <code>string</code> | | |
629
- | **`url`** | <code>string</code> | | |
1419
+ Use this after {@link getMissingBundleFiles} to estimate only the files this
1420
+ device still needs:
630
1421
 
1422
+ ```typescript
1423
+ const latest = await CapacitorUpdater.getLatest();
1424
+ const missing = await CapacitorUpdater.getMissingBundleFiles(latest);
1425
+ const size = await CapacitorUpdater.getBundleDownloadSize({
1426
+ version: latest.version,
1427
+ manifest: missing.missing,
1428
+ });
1429
+ ```
631
1430
 
632
- #### channelRes
1431
+ | Param | Type | Description |
1432
+ | ------------- | ------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
1433
+ | **`options`** | <code><a href="#getbundledownloadsizeoptions">GetBundleDownloadSizeOptions</a></code> | A {@link <a href="#getbundledownloadsizeoptions">GetBundleDownloadSizeOptions</a>} object containing manifest entries. |
633
1434
 
634
- | Prop | Type | Description | Since |
635
- | ------------- | ------------------- | ----------------------------- | ----- |
636
- | **`status`** | <code>string</code> | Current status of set channel | 4.7.0 |
637
- | **`error`** | <code>any</code> | | |
638
- | **`message`** | <code>any</code> | | |
1435
+ **Returns:** <code>Promise&lt;<a href="#getbundledownloadsizeresult">GetBundleDownloadSizeResult</a>&gt;</code>
639
1436
 
1437
+ **Since:** 8.47.0
640
1438
 
641
- #### SetChannelOptions
1439
+ --------------------
642
1440
 
643
- | Prop | Type |
644
- | ------------- | ------------------- |
645
- | **`channel`** | <code>string</code> |
646
1441
 
1442
+ #### setChannel(...)
647
1443
 
648
- #### getChannelRes
1444
+ ```typescript
1445
+ setChannel(options: SetChannelOptions) => Promise<ChannelRes>
1446
+ ```
649
1447
 
650
- | Prop | Type | Description | Since |
651
- | -------------- | -------------------- | ----------------------------- | ----- |
652
- | **`channel`** | <code>string</code> | Current status of get channel | 4.8.0 |
653
- | **`error`** | <code>any</code> | | |
654
- | **`message`** | <code>any</code> | | |
655
- | **`status`** | <code>string</code> | | |
656
- | **`allowSet`** | <code>boolean</code> | | |
1448
+ Assign this device to a specific update channel at runtime.
657
1449
 
1450
+ Channels allow you to distribute different bundle versions to different groups of users
1451
+ (e.g., "production", "beta", "staging"). This method switches the device to a new channel.
658
1452
 
659
- #### SetCustomIdOptions
1453
+ **Device Override UI:** `setChannel()` validates the channel with the backend, then stores the
1454
+ selected channel locally on the device for future app restarts. It does not create or update
1455
+ a backend Device Override, so the device will not appear as overridden in the Capgo dashboard.
1456
+ Only assignments created from the dashboard or the Public API are shown in the Device Override UI.
660
1457
 
661
- | Prop | Type |
662
- | -------------- | ------------------- |
663
- | **`customId`** | <code>string</code> |
1458
+ **Requirements:**
1459
+ - The target channel must allow self-assignment (configured in your Capgo dashboard or backend)
1460
+ - The backend may accept or reject the request based on channel settings
664
1461
 
1462
+ **When to use:**
1463
+ - After the app is ready and the user has interacted (e.g., opted into beta program)
1464
+ - To implement in-app channel switching (beta toggle, tester access, etc.)
1465
+ - For user-driven channel changes
665
1466
 
666
- #### PluginListenerHandle
1467
+ **When NOT to use:**
1468
+ - At app boot/initialization - use {@link PluginsConfig.CapacitorUpdater.defaultChannel} config instead
1469
+ - Before user interaction
667
1470
 
668
- | Prop | Type |
669
- | ------------ | ----------------------------------------- |
670
- | **`remove`** | <code>() =&gt; Promise&lt;void&gt;</code> |
1471
+ **Important: Listen for the `channelPrivate` event**
671
1472
 
1473
+ When a user attempts to set a channel that doesn't allow device self-assignment, the method will
1474
+ throw an error AND emit a `channelPrivate` {@link <a href="#updaterevent">UpdaterEvent</a>}. You should listen to this event
1475
+ to provide appropriate feedback to users:
672
1476
 
673
- #### DownloadEvent
1477
+ ```typescript
1478
+ CapacitorUpdater.addListener('updaterEvent', (event) => {
1479
+ if (event.type === 'channelPrivate') {
1480
+ console.warn(`Cannot access channel "${event.data.channel}": ${event.data.message}`);
1481
+ // Show user-friendly message
1482
+ }
1483
+ });
1484
+ ```
1485
+
1486
+ This sends a request to the Capgo backend to validate the specified channel, then stores the
1487
+ channel locally on the device for future app restarts.
1488
+
1489
+ | Param | Type | Description |
1490
+ | ------------- | --------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
1491
+ | **`options`** | <code><a href="#setchanneloptions">SetChannelOptions</a></code> | The {@link <a href="#setchanneloptions">SetChannelOptions</a>} containing the channel name and optional auto-update trigger. |
1492
+
1493
+ **Returns:** <code>Promise&lt;<a href="#channelres">ChannelRes</a>&gt;</code>
1494
+
1495
+ **Since:** 4.7.0
1496
+
1497
+ --------------------
1498
+
1499
+
1500
+ #### unsetChannel(...)
1501
+
1502
+ ```typescript
1503
+ unsetChannel(options: UnsetChannelOptions) => Promise<void>
1504
+ ```
1505
+
1506
+ Remove the plugin-managed local channel assignment and return to the default channel.
1507
+
1508
+ This clears only the channel stored locally by {@link setChannel}; it does not delete Dashboard or Public API Device Override records. After the local assignment is cleared, normal channel precedence applies:
1509
+ - An existing Dashboard or Public API Device Override, if one exists
1510
+ - The {@link PluginsConfig.CapacitorUpdater.defaultChannel} if configured, or
1511
+ - Your backend default channel for this app
1512
+
1513
+ Use this when:
1514
+ - Users opt out of beta/testing programs
1515
+ - You want to reset a device to standard update distribution
1516
+ - Testing channel switching behavior
1517
+
1518
+ | Param | Type |
1519
+ | ------------- | ------------------------------------------------------------------- |
1520
+ | **`options`** | <code><a href="#unsetchanneloptions">UnsetChannelOptions</a></code> |
1521
+
1522
+ **Since:** 4.7.0
1523
+
1524
+ --------------------
1525
+
1526
+
1527
+ #### getChannel()
1528
+
1529
+ ```typescript
1530
+ getChannel() => Promise<GetChannelRes>
1531
+ ```
1532
+
1533
+ Get the current channel assigned to this device.
1534
+
1535
+ Returns information about:
1536
+ - `channel`: The currently assigned channel name (if any)
1537
+ - `allowSet`: Whether the channel allows self-assignment
1538
+ - `status`: Operation status
1539
+ - `error`/`message`: Additional information (if applicable)
1540
+
1541
+ Use this to:
1542
+ - Display current channel to users (e.g., "You're on the Beta channel")
1543
+ - Check if a device is on a specific channel before showing features
1544
+ - Verify channel assignment after calling {@link setChannel}
1545
+
1546
+ On native platforms, a successful response with a device channel override also refreshes the
1547
+ default channel used by update checks. Responses with `status: 'default'` are reported only and
1548
+ are not persisted. This refresh is persisted across app restarts.
1549
+
1550
+ **Returns:** <code>Promise&lt;<a href="#getchannelres">GetChannelRes</a>&gt;</code>
1551
+
1552
+ **Since:** 4.8.0
1553
+
1554
+ --------------------
1555
+
1556
+
1557
+ #### listChannels()
1558
+
1559
+ ```typescript
1560
+ listChannels() => Promise<ListChannelsResult>
1561
+ ```
1562
+
1563
+ Get a list of all channels available for this device to self-assign to.
1564
+
1565
+ Only returns channels where `allow_self_set` is `true`. These are channels that
1566
+ users can switch to using {@link setChannel} without backend administrator intervention.
1567
+
1568
+ Each channel includes:
1569
+ - `id`: Unique channel identifier
1570
+ - `name`: Human-readable channel name
1571
+ - `public`: Whether the channel is publicly visible
1572
+ - `allow_self_set`: Always `true` in results (filtered to only self-assignable channels)
1573
+
1574
+ Use this to:
1575
+ - Build a channel selector UI for users (e.g., "Join Beta" button)
1576
+ - Show available testing/preview channels
1577
+ - Implement channel discovery features
1578
+
1579
+ **Returns:** <code>Promise&lt;<a href="#listchannelsresult">ListChannelsResult</a>&gt;</code>
1580
+
1581
+ **Since:** 7.5.0
1582
+
1583
+ --------------------
1584
+
1585
+
1586
+ #### setCustomId(...)
1587
+
1588
+ ```typescript
1589
+ setCustomId(options: SetCustomIdOptions) => Promise<void>
1590
+ ```
1591
+
1592
+ Set a custom identifier for this device.
1593
+
1594
+ This allows you to identify devices by your own custom ID (user ID, account ID, etc.)
1595
+ instead of or in addition to the device's unique hardware ID. The custom ID is sent
1596
+ to your update server and can be used for:
1597
+ - Targeting specific users for updates
1598
+ - Analytics and user tracking
1599
+ - Debugging and support (correlating devices with users)
1600
+ - A/B testing or feature flagging
1601
+
1602
+ **Persistence:**
1603
+ - When {@link PluginsConfig.CapacitorUpdater.persistCustomId} is `true` (the default), the ID persists across app restarts
1604
+ - When `false`, the ID is only kept for the current session
1605
+
1606
+ **Clearing the custom ID:**
1607
+ - Pass an empty string `""` to remove any stored custom ID, even when persistence is disabled
1608
+
1609
+ | Param | Type | Description |
1610
+ | ------------- | ----------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
1611
+ | **`options`** | <code><a href="#setcustomidoptions">SetCustomIdOptions</a></code> | The {@link <a href="#setcustomidoptions">SetCustomIdOptions</a>} containing the custom identifier string. |
1612
+
1613
+ **Since:** 4.9.0
1614
+
1615
+ --------------------
1616
+
1617
+
1618
+ #### getBuiltinVersion()
1619
+
1620
+ ```typescript
1621
+ getBuiltinVersion() => Promise<BuiltinVersion>
1622
+ ```
1623
+
1624
+ Get the builtin bundle version (the original version shipped with your native app).
1625
+
1626
+ This returns the version of the bundle that was included when the app was installed
1627
+ from the App Store or Play Store. This is NOT the currently active bundle version -
1628
+ use {@link current} for that.
1629
+
1630
+ Returns:
1631
+ - The {@link PluginsConfig.CapacitorUpdater.version} config value if set, or
1632
+ - The native app version from platform configs (package.json, Info.plist, build.gradle)
1633
+
1634
+ Use this to:
1635
+ - Display the "factory" version to users
1636
+ - Compare against downloaded bundle versions
1637
+ - Determine if any updates have been applied
1638
+ - Debugging version mismatches
1639
+
1640
+ **Returns:** <code>Promise&lt;<a href="#builtinversion">BuiltinVersion</a>&gt;</code>
1641
+
1642
+ **Since:** 5.2.0
1643
+
1644
+ --------------------
1645
+
1646
+
1647
+ #### getDeviceId()
1648
+
1649
+ ```typescript
1650
+ getDeviceId() => Promise<DeviceId>
1651
+ ```
1652
+
1653
+ Get the unique, privacy-friendly identifier for this device.
1654
+
1655
+ This ID is used to identify the device when communicating with update servers.
1656
+ It's automatically generated and stored securely by the plugin.
1657
+
1658
+ **Privacy & Security characteristics:**
1659
+ - Generated as a UUID (not based on hardware identifiers)
1660
+ - Stored securely in platform-specific secure storage
1661
+ - Android: mirrored into backup-restorable app preferences for reinstall restore
1662
+ - iOS: Keychain with `kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly`
1663
+ - Not synced to cloud (iOS)
1664
+ - Follows Apple and Google privacy best practices
1665
+ - Users can clear it via system settings (Android) or keychain access (iOS)
1666
+
1667
+ **Persistence:**
1668
+ The device ID persists across app reinstalls to maintain consistent device identity
1669
+ for update tracking and analytics when platform storage is preserved. On Android,
1670
+ apps with custom backup rules must keep the plugin app preferences eligible for
1671
+ backup/restore; disabling Android backup or clearing app data creates a new ID.
1672
+
1673
+ Use this to:
1674
+ - Debug update delivery issues (check what ID the server sees)
1675
+ - Implement device-specific features
1676
+ - Correlate server logs with specific devices
1677
+
1678
+ **Returns:** <code>Promise&lt;<a href="#deviceid">DeviceId</a>&gt;</code>
1679
+
1680
+ --------------------
1681
+
1682
+
1683
+ #### getPluginVersion()
1684
+
1685
+ ```typescript
1686
+ getPluginVersion() => Promise<PluginVersion>
1687
+ ```
1688
+
1689
+ Get the version of the Capacitor Updater plugin installed in your app.
1690
+
1691
+ This returns the version of the native plugin code (Android/iOS), which is sent
1692
+ to the update server with each request. This is NOT your app version or bundle version.
1693
+
1694
+ Use this to:
1695
+ - Debug plugin-specific issues (when reporting bugs)
1696
+ - Verify plugin installation and version
1697
+ - Check compatibility with backend features
1698
+ - Display in debug/about screens
1699
+
1700
+ **Returns:** <code>Promise&lt;<a href="#pluginversion">PluginVersion</a>&gt;</code>
1701
+
1702
+ --------------------
1703
+
1704
+
1705
+ #### isAutoUpdateEnabled()
1706
+
1707
+ ```typescript
1708
+ isAutoUpdateEnabled() => Promise<AutoUpdateEnabled>
1709
+ ```
1710
+
1711
+ Check if automatic updates are currently enabled.
1712
+
1713
+ Returns `true` if {@link PluginsConfig.CapacitorUpdater.autoUpdate} is enabled,
1714
+ meaning the plugin will automatically check for, download, and apply updates.
1715
+
1716
+ Returns `false` if in manual mode, where you control the update flow using
1717
+ {@link getLatest}, {@link download}, {@link next}, and {@link set}.
1718
+
1719
+ Use this to:
1720
+ - Determine which update flow your app is using
1721
+ - Show/hide manual update UI based on mode
1722
+ - Debug update behavior
1723
+
1724
+ **Returns:** <code>Promise&lt;<a href="#autoupdateenabled">AutoUpdateEnabled</a>&gt;</code>
1725
+
1726
+ --------------------
1727
+
1728
+
1729
+ #### removeAllListeners()
1730
+
1731
+ ```typescript
1732
+ removeAllListeners() => Promise<void>
1733
+ ```
1734
+
1735
+ Remove all event listeners registered for this plugin.
1736
+
1737
+ This unregisters every listener added via {@link addListener}, including all
1738
+ `updaterEvent` listeners.
1739
+
1740
+ Use this during cleanup (e.g., when unmounting components or closing screens)
1741
+ to prevent memory leaks from lingering event listeners.
1742
+
1743
+ **Since:** 1.0.0
1744
+
1745
+ --------------------
1746
+
1747
+
1748
+ #### addListener('updaterEvent', ...)
1749
+
1750
+ ```typescript
1751
+ addListener(eventName: 'updaterEvent', listenerFunc: (event: UpdaterEvent) => void) => Promise<PluginListenerHandle>
1752
+ ```
1753
+
1754
+ Listen for every updater event with a single listener.
1755
+
1756
+ Each call receives `{ type, data }`: `type` is the event name and `data` is its payload
1757
+ (see {@link <a href="#updaterevent">UpdaterEvent</a>} for every type and its payload).
1758
+
1759
+ Since 9.0.0 this is the only listener the plugin emits. The per-event listeners
1760
+ (`addListener('download', ...)`, `addListener('appReady', ...)`, ...) and the `majorAvailable`
1761
+ alias were removed: switch on `event.type` instead.
1762
+
1763
+ Some events are retained natively until a listener attaches: `set`, `appReady`, `noNeedUpdate`, and
1764
+ `updateAvailable` from the automatic update when `autoUpdate` is `onlyDownload`. Do not rely on retention for an
1765
+ `updateAvailable` from a manual `download()` (iOS does not retain it): register the listener before calling it.
1766
+ The first `updaterEvent` listener receives every
1767
+ retained event in emission order, so these are still delivered after a reload or a fast update check
1768
+ even when the listener is registered later in app startup.
1769
+
1770
+ ```typescript
1771
+ CapacitorUpdater.addListener('updaterEvent', (event) => {
1772
+ switch (event.type) {
1773
+ case 'download':
1774
+ console.log('progress', event.data.percent);
1775
+ break;
1776
+ case 'downloadFailed':
1777
+ console.warn('download failed', event.data.version);
1778
+ break;
1779
+ case 'channelPrivate':
1780
+ console.warn(`Cannot access channel "${event.data.channel}": ${event.data.message}`);
1781
+ break;
1782
+ }
1783
+ });
1784
+ ```
1785
+
1786
+ | Param | Type |
1787
+ | ------------------ | ------------------------------------------------------------------------- |
1788
+ | **`eventName`** | <code>'updaterEvent'</code> |
1789
+ | **`listenerFunc`** | <code>(event: <a href="#updaterevent">UpdaterEvent</a>) =&gt; void</code> |
1790
+
1791
+ **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
1792
+
1793
+ **Since:** 8.53.0
1794
+
1795
+ --------------------
1796
+
1797
+
1798
+ #### isAutoUpdateAvailable()
1799
+
1800
+ ```typescript
1801
+ isAutoUpdateAvailable() => Promise<AutoUpdateAvailable>
1802
+ ```
1803
+
1804
+ Check if the auto-update feature is available (not disabled by custom server configuration).
1805
+
1806
+ Returns `false` when a custom `updateUrl` is configured, as this typically indicates
1807
+ you're using a self-hosted update server that may not support all auto-update features.
1808
+
1809
+ Returns `true` when using the default Capgo backend or when the feature is available.
1810
+
1811
+ This is different from {@link isAutoUpdateEnabled}:
1812
+ - `isAutoUpdateEnabled()`: Checks if auto-update MODE is turned on/off
1813
+ - `isAutoUpdateAvailable()`: Checks if auto-update is SUPPORTED with your current configuration
1814
+
1815
+ **Returns:** <code>Promise&lt;<a href="#autoupdateavailable">AutoUpdateAvailable</a>&gt;</code>
1816
+
1817
+ --------------------
1818
+
1819
+
1820
+ #### getNextBundle()
1821
+
1822
+ ```typescript
1823
+ getNextBundle() => Promise<BundleInfo | null>
1824
+ ```
1825
+
1826
+ Get information about the bundle queued to be activated on next reload.
1827
+
1828
+ Returns:
1829
+ - {@link <a href="#bundleinfo">BundleInfo</a>} object if a bundle has been queued via {@link next}
1830
+ - `null` if no update is pending
1831
+
1832
+ This is useful to:
1833
+ - Check if an update is waiting to be applied
1834
+ - Display "Update pending" status to users
1835
+ - Show version info of the queued update
1836
+ - Decide whether to show a "Restart to update" prompt
1837
+
1838
+ The queued bundle will be activated when:
1839
+ - The app is backgrounded (default behavior)
1840
+ - The app is killed and restarted
1841
+ - {@link reload} is called manually
1842
+ - Delay conditions set by {@link setMultiDelay} are met
1843
+
1844
+ **Returns:** <code>Promise&lt;<a href="#bundleinfo">BundleInfo</a> | null&gt;</code>
1845
+
1846
+ **Since:** 6.8.0
1847
+
1848
+ --------------------
1849
+
1850
+
1851
+ #### getFailedUpdate()
1852
+
1853
+ ```typescript
1854
+ getFailedUpdate() => Promise<UpdateFailedEvent | null>
1855
+ ```
1856
+
1857
+ Retrieve information about the most recent bundle that failed to load.
1858
+
1859
+ When a bundle fails to load (e.g., JavaScript errors prevent initialization, missing files),
1860
+ the plugin automatically rolls back and stores information about the failure. This method
1861
+ retrieves that failure information.
1862
+
1863
+ **IMPORTANT: The stored value is cleared after being retrieved once.**
1864
+ Calling this method multiple times will only return the failure info on the first call,
1865
+ then `null` on subsequent calls until another failure occurs.
1866
+
1867
+ Returns:
1868
+ - {@link <a href="#updatefailedevent">UpdateFailedEvent</a>} with bundle info if a failure was recorded
1869
+ - `null` if no failure has occurred or if it was already retrieved
1870
+
1871
+ Use this to:
1872
+ - Show users why an update failed
1873
+ - Log failure information for debugging
1874
+ - Implement custom error handling/reporting
1875
+ - Display rollback notifications
1876
+
1877
+ **Returns:** <code>Promise&lt;<a href="#updatefailedevent">UpdateFailedEvent</a> | null&gt;</code>
1878
+
1879
+ **Since:** 7.22.0
1880
+
1881
+ --------------------
1882
+
1883
+
1884
+ #### setShakeMenu(...)
1885
+
1886
+ ```typescript
1887
+ setShakeMenu(options: SetShakeMenuOptions) => Promise<void>
1888
+ ```
1889
+
1890
+ Enable or disable the native preview menu gesture.
1891
+
1892
+ During preview sessions, users can use the configured native gesture to:
1893
+ - Reload the current preview
1894
+ - Leave the test app and return to the fallback bundle
1895
+ - Switch update channel, when {@link PluginsConfig.CapacitorUpdater.allowShakeChannelSelector} is also enabled
1896
+
1897
+ Outside preview sessions, this preview menu is ignored. The channel selector can still be
1898
+ shown outside preview sessions when {@link PluginsConfig.CapacitorUpdater.allowShakeChannelSelector} is enabled.
1899
+
1900
+ **Important:** Disable this in production builds or only enable for internal testers.
1901
+
1902
+ This can also be configured via {@link PluginsConfig.CapacitorUpdater.shakeMenu}.
1903
+ The native gesture is configured via {@link PluginsConfig.CapacitorUpdater.shakeMenuGesture}.
1904
+
1905
+ | Param | Type |
1906
+ | ------------- | ------------------------------------------------------------------- |
1907
+ | **`options`** | <code><a href="#setshakemenuoptions">SetShakeMenuOptions</a></code> |
1908
+
1909
+ **Since:** 7.5.0
1910
+
1911
+ --------------------
1912
+
1913
+
1914
+ #### isShakeMenuEnabled()
1915
+
1916
+ ```typescript
1917
+ isShakeMenuEnabled() => Promise<ShakeMenuEnabled>
1918
+ ```
1919
+
1920
+ Check if the native preview menu gesture is currently enabled.
1921
+
1922
+ Returns the current state of the shake menu feature that can be toggled via
1923
+ {@link setShakeMenu} or configured via {@link PluginsConfig.CapacitorUpdater.shakeMenu}.
1924
+
1925
+ Use this to:
1926
+ - Check if debug features are enabled
1927
+ - Show/hide debug settings UI
1928
+ - Verify configuration during testing
1929
+
1930
+ **Returns:** <code>Promise&lt;<a href="#shakemenuenabled">ShakeMenuEnabled</a>&gt;</code>
1931
+
1932
+ **Since:** 7.5.0
1933
+
1934
+ --------------------
1935
+
1936
+
1937
+ #### setShakeChannelSelector(...)
1938
+
1939
+ ```typescript
1940
+ setShakeChannelSelector(options: SetShakeChannelSelectorOptions) => Promise<void>
1941
+ ```
1942
+
1943
+ Enable or disable the channel selector menu gesture at runtime.
1944
+
1945
+ When enabled, the configured native gesture can show a channel selector, including outside preview sessions.
1946
+ If {@link setShakeMenu} is also enabled while a preview session is active, the shake menu includes
1947
+ both preview actions and channel switching.
1948
+
1949
+ This can also be configured via {@link PluginsConfig.CapacitorUpdater.allowShakeChannelSelector}.
1950
+ The native gesture is configured via {@link PluginsConfig.CapacitorUpdater.shakeMenuGesture}.
1951
+
1952
+ | Param | Type |
1953
+ | ------------- | ----------------------------------------------------------------------------------------- |
1954
+ | **`options`** | <code><a href="#setshakechannelselectoroptions">SetShakeChannelSelectorOptions</a></code> |
1955
+
1956
+ **Since:** 8.43.0
1957
+
1958
+ --------------------
1959
+
1960
+
1961
+ #### isShakeChannelSelectorEnabled()
1962
+
1963
+ ```typescript
1964
+ isShakeChannelSelectorEnabled() => Promise<ShakeChannelSelectorEnabled>
1965
+ ```
1966
+
1967
+ Check if the shake channel selector is currently enabled.
1968
+
1969
+ Returns the current state of the shake channel selector feature that can be toggled via
1970
+ {@link setShakeChannelSelector} or configured via {@link PluginsConfig.CapacitorUpdater.allowShakeChannelSelector}.
1971
+
1972
+ **Returns:** <code>Promise&lt;<a href="#shakechannelselectorenabled">ShakeChannelSelectorEnabled</a>&gt;</code>
1973
+
1974
+ **Since:** 8.43.0
1975
+
1976
+ --------------------
1977
+
1978
+
1979
+ #### getAppId()
1980
+
1981
+ ```typescript
1982
+ getAppId() => Promise<GetAppIdRes>
1983
+ ```
1984
+
1985
+ Get the currently configured App ID used for update server communication.
1986
+
1987
+ Returns the App ID that identifies this app to the update server. This can be:
1988
+ - The value set via {@link setAppId}, or
1989
+ - The {@link PluginsConfig.CapacitorUpdater.appId} config value, or
1990
+ - The default app identifier from your native app configuration
1991
+
1992
+ Use this to:
1993
+ - Verify which App ID is being used for updates
1994
+ - Debug update delivery issues
1995
+ - Display app configuration in debug screens
1996
+ - Confirm App ID after calling {@link setAppId}
1997
+
1998
+ **Returns:** <code>Promise&lt;<a href="#getappidres">GetAppIdRes</a>&gt;</code>
1999
+
2000
+ **Since:** 7.14.0
2001
+
2002
+ --------------------
2003
+
2004
+
2005
+ #### setAppId(...)
2006
+
2007
+ ```typescript
2008
+ setAppId(options: SetAppIdOptions) => Promise<void>
2009
+ ```
2010
+
2011
+ Dynamically change the App ID used for update server communication.
2012
+
2013
+ This overrides the App ID used to identify your app to the update server, allowing you
2014
+ to switch between different app configurations at runtime (e.g., production vs staging
2015
+ app IDs, or multi-tenant configurations).
2016
+
2017
+ **Requirements:**
2018
+ - {@link PluginsConfig.CapacitorUpdater.allowModifyAppId} must be set to `true`
2019
+
2020
+ **Important considerations:**
2021
+ - Changing the App ID will affect which updates this device receives
2022
+ - The new App ID must exist on your update server
2023
+ - This is primarily for advanced use cases (multi-tenancy, environment switching)
2024
+ - Most apps should use the config-based {@link PluginsConfig.CapacitorUpdater.appId} instead
2025
+
2026
+ | Param | Type |
2027
+ | ------------- | ----------------------------------------------------------- |
2028
+ | **`options`** | <code><a href="#setappidoptions">SetAppIdOptions</a></code> |
2029
+
2030
+ **Since:** 7.14.0
2031
+
2032
+ --------------------
2033
+
2034
+
2035
+ #### getAppUpdateInfo(...)
2036
+
2037
+ ```typescript
2038
+ getAppUpdateInfo(options?: GetAppUpdateInfoOptions | undefined) => Promise<AppUpdateInfo>
2039
+ ```
2040
+
2041
+ Get information about the app's availability in the App Store or Play Store.
2042
+
2043
+ This method checks the native app stores to see if a newer version of the app
2044
+ is available for download. This is different from Capgo's OTA updates - this
2045
+ checks for native app updates that require going through the app stores.
2046
+
2047
+ **Platform differences:**
2048
+ - **Android**: Uses Play Store's In-App Updates API for accurate update information
2049
+ - **iOS**: Queries the App Store lookup API (requires country code for accurate results)
2050
+
2051
+ **Returns information about:**
2052
+ - Current installed version
2053
+ - Available version in the store (if any)
2054
+ - Whether an update is available
2055
+ - Update priority (Android only)
2056
+ - Whether immediate/flexible updates are allowed (Android only)
2057
+
2058
+ Use this to:
2059
+ - Check if users need to update from the app store
2060
+ - Show "Update Available" prompts for native updates
2061
+ - Implement version gating (require minimum native version)
2062
+ - Combine with Capgo OTA updates for a complete update strategy
2063
+
2064
+ | Param | Type | Description |
2065
+ | ------------- | --------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
2066
+ | **`options`** | <code><a href="#getappupdateinfooptions">GetAppUpdateInfoOptions</a></code> | Optional {@link <a href="#getappupdateinfooptions">GetAppUpdateInfoOptions</a>} with country code for iOS. |
2067
+
2068
+ **Returns:** <code>Promise&lt;<a href="#appupdateinfo">AppUpdateInfo</a>&gt;</code>
2069
+
2070
+ **Since:** 8.0.0
2071
+
2072
+ --------------------
2073
+
2074
+
2075
+ #### openAppStore(...)
2076
+
2077
+ ```typescript
2078
+ openAppStore(options?: OpenAppStoreOptions | undefined) => Promise<void>
2079
+ ```
2080
+
2081
+ Open the app's page in the App Store or Play Store.
2082
+
2083
+ This navigates the user to your app's store listing where they can manually
2084
+ update the app. Use this as a fallback when in-app updates are not available
2085
+ or when the user needs to update on iOS.
2086
+
2087
+ **Platform behavior:**
2088
+ - **Android**: Opens Play Store to the app's page
2089
+ - **iOS**: Opens App Store to the app's page
2090
+
2091
+ **Customization options:**
2092
+ - `appId`: Specify a custom App Store ID (iOS) - useful for opening a different app's page
2093
+ - `packageName`: Specify a custom package name (Android) - useful for opening a different app's page
2094
+
2095
+ | Param | Type | Description |
2096
+ | ------------- | ------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- |
2097
+ | **`options`** | <code><a href="#openappstoreoptions">OpenAppStoreOptions</a></code> | Optional {@link <a href="#openappstoreoptions">OpenAppStoreOptions</a>} to customize which app's store page to open. |
2098
+
2099
+ **Since:** 8.0.0
2100
+
2101
+ --------------------
2102
+
2103
+
2104
+ #### performImmediateUpdate()
2105
+
2106
+ ```typescript
2107
+ performImmediateUpdate() => Promise<AppUpdateResult>
2108
+ ```
2109
+
2110
+ Perform an immediate in-app update on Android.
2111
+
2112
+ This triggers Google Play's immediate update flow, which:
2113
+ 1. Shows a full-screen update UI
2114
+ 2. Downloads and installs the update
2115
+ 3. Restarts the app automatically
2116
+
2117
+ The user cannot continue using the app until the update is complete.
2118
+ This is ideal for critical updates that must be installed immediately.
2119
+
2120
+ **Requirements:**
2121
+ - Android only (throws error on iOS)
2122
+ - An update must be available (check with {@link getAppUpdateInfo} first)
2123
+ - The update must allow immediate updates (`immediateUpdateAllowed: true`)
2124
+
2125
+ **User experience:**
2126
+ - Full-screen blocking UI
2127
+ - Progress shown during download
2128
+ - App automatically restarts after installation
2129
+
2130
+ **Returns:** <code>Promise&lt;<a href="#appupdateresult">AppUpdateResult</a>&gt;</code>
2131
+
2132
+ **Since:** 8.0.0
2133
+
2134
+ --------------------
2135
+
2136
+
2137
+ #### startFlexibleUpdate()
2138
+
2139
+ ```typescript
2140
+ startFlexibleUpdate() => Promise<AppUpdateResult>
2141
+ ```
2142
+
2143
+ Start a flexible in-app update on Android.
2144
+
2145
+ This triggers Google Play's flexible update flow, which:
2146
+ 1. Downloads the update in the background
2147
+ 2. Allows the user to continue using the app
2148
+ 3. Notifies when download is complete
2149
+ 4. Requires calling {@link completeFlexibleUpdate} to install
2150
+
2151
+ Monitor the download progress with the `onFlexibleUpdateStateChange` type of `updaterEvent`.
2152
+
2153
+ **Requirements:**
2154
+ - Android only (throws error on iOS)
2155
+ - An update must be available (check with {@link getAppUpdateInfo} first)
2156
+ - The update must allow flexible updates (`flexibleUpdateAllowed: true`)
2157
+
2158
+ **Typical flow:**
2159
+ 1. Register `addListener('updaterEvent', ...)` and await it, handling `onFlexibleUpdateStateChange`
2160
+ for progress, so no state change is missed
2161
+ 2. Call `startFlexibleUpdate()` to begin download
2162
+ 3. When status is `DOWNLOADED`, prompt user to restart
2163
+ 4. Call `completeFlexibleUpdate()` to install and restart
2164
+
2165
+ **Returns:** <code>Promise&lt;<a href="#appupdateresult">AppUpdateResult</a>&gt;</code>
2166
+
2167
+ **Since:** 8.0.0
2168
+
2169
+ --------------------
2170
+
2171
+
2172
+ #### completeFlexibleUpdate()
2173
+
2174
+ ```typescript
2175
+ completeFlexibleUpdate() => Promise<void>
2176
+ ```
2177
+
2178
+ Complete a flexible in-app update on Android.
2179
+
2180
+ After a flexible update has been downloaded (status `DOWNLOADED` in
2181
+ `onFlexibleUpdateStateChange`), call this method to install the update
2182
+ and restart the app.
2183
+
2184
+ **Important:** This will immediately restart the app. Make sure to:
2185
+ - Save any user data before calling
2186
+ - Prompt the user before restarting
2187
+ - Only call when the download status is `DOWNLOADED`
2188
+
2189
+ **Since:** 8.0.0
2190
+
2191
+ --------------------
2192
+
2193
+
2194
+ #### Interfaces
2195
+
2196
+
2197
+ ##### AppReadyResult
2198
+
2199
+ | Prop | Type |
2200
+ | ------------ | ------------------------------------------------- |
2201
+ | **`bundle`** | <code><a href="#bundleinfo">BundleInfo</a></code> |
2202
+
2203
+
2204
+ ##### BundleInfo
2205
+
2206
+ | Prop | Type |
2207
+ | ---------------- | ----------------------------------------------------- |
2208
+ | **`id`** | <code>string</code> |
2209
+ | **`version`** | <code>string</code> |
2210
+ | **`downloaded`** | <code>string</code> |
2211
+ | **`checksum`** | <code>string</code> |
2212
+ | **`status`** | <code><a href="#bundlestatus">BundleStatus</a></code> |
2213
+
2214
+
2215
+ ##### UpdateUrl
2216
+
2217
+ | Prop | Type |
2218
+ | --------- | ------------------- |
2219
+ | **`url`** | <code>string</code> |
2220
+
2221
+
2222
+ ##### StatsUrl
2223
+
2224
+ | Prop | Type |
2225
+ | --------- | ------------------- |
2226
+ | **`url`** | <code>string</code> |
2227
+
2228
+
2229
+ ##### ChannelUrl
2230
+
2231
+ | Prop | Type |
2232
+ | --------- | ------------------- |
2233
+ | **`url`** | <code>string</code> |
2234
+
2235
+
2236
+ ##### DownloadOptions
2237
+
2238
+ This URL and versions are used to download the bundle from the server, If you use backend all information will be given by the method getLatest.
2239
+ If you don't use backend, you need to provide the URL and version of the bundle. Encrypted ZIP downloads require checksum and sessionKey. Encrypted manifest downloads require
2240
+ sessionKey and a signed file_hash for each manifest entry. For updater 9, take them from the Capgo CLI upload flow, which produces the v9 checksum format when it
2241
+ detects updater 9 in the project; see "Migration to v9" in the README. A standalone encrypt command may not produce it.
2242
+
2243
+ | Prop | Type | Description | Default | Since |
2244
+ | ---------------- | ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------- | ----- |
2245
+ | **`url`** | <code>string</code> | The URL of the bundle zip file (e.g: dist.zip) to be downloaded. (This can be any URL. E.g: Amazon S3, a GitHub tag, any other place you've hosted your bundle.) | | |
2246
+ | **`version`** | <code>string</code> | The version code/name of this bundle/version | | |
2247
+ | **`sessionKey`** | <code>string</code> | The session key for the update, when the bundle is encrypted with a session key | <code>undefined</code> | 4.0.0 |
2248
+ | **`checksum`** | <code>string</code> | The checksum for the update, it should be in sha256 and encrypted with private key if the bundle is encrypted. Since 9.0.0, the checksum of an encrypted bundle must sign both the SHA-256 of the bundle zip and the SHA-256 of the encrypted bytes. The plugin checks the downloaded bytes against it before decrypting them. The Capgo CLI upload flow produces this format when it detects updater 9 in the project; for self-hosted updates, follow "Migration to v9" in the README instead of relying on a standalone encrypt command. | <code>undefined</code> | 4.0.0 |
2249
+ | **`manifest`** | <code>ManifestEntry[]</code> | The manifest for multi-file downloads | <code>undefined</code> | 6.1.0 |
2250
+
2251
+
2252
+ ##### ManifestEntry
2253
+
2254
+ | Prop | Type |
2255
+ | ------------------ | --------------------------- |
2256
+ | **`file_name`** | <code>string \| null</code> |
2257
+ | **`file_hash`** | <code>string \| null</code> |
2258
+ | **`download_url`** | <code>string \| null</code> |
2259
+
2260
+
2261
+ ##### BundleId
2262
+
2263
+ | Prop | Type |
2264
+ | -------- | ------------------- |
2265
+ | **`id`** | <code>string</code> |
2266
+
2267
+
2268
+ ##### StartPreviewSessionOptions
2269
+
2270
+ | Prop | Type | Description | Default | Since |
2271
+ | ---------------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------- | ------ |
2272
+ | **`appId`** | <code>string</code> | App id to use while the preview session is active. The previous app id is restored when leaving the preview session. Requires {@link PluginsConfig.CapacitorUpdater.allowPreview} to be `true`. | <code>undefined</code> | 8.47.0 |
2273
+ | **`payloadUrl`** | <code>string</code> | HTTP(S) URL returning a preview download payload. When provided, the native shake reload action fetches this payload again before reloading so channel previews can move to the latest bundle. Requires {@link PluginsConfig.CapacitorUpdater.allowPreview} to be `true`. | <code>undefined</code> | 8.48.0 |
2274
+ | **`name`** | <code>string</code> | Human-readable preview name stored with the next preview bundle applied by {@link set}. Native preview menus and {@link listPreviews} can display it. | <code>undefined</code> | 8.49.0 |
2275
+ | **`source`** | <code>string</code> | Optional source label for the preview, such as `channel`, `bundle`, `url`, or `payload`. This is stored as metadata only. | <code>undefined</code> | 8.49.0 |
2276
+
2277
+
2278
+ ##### PreviewListResult
2279
+
2280
+ | Prop | Type | Description | Since |
2281
+ | ------------------- | --------------------------------------------------- | ------------------------------------------------------- | ------ |
2282
+ | **`previews`** | <code>PreviewInfo[]</code> | Locally available preview bundles. | 8.49.0 |
2283
+ | **`current`** | <code><a href="#previewinfo">PreviewInfo</a></code> | Current preview when a preview session is active. | 8.49.0 |
2284
+ | **`currentBundle`** | <code><a href="#bundleinfo">BundleInfo</a></code> | Bundle currently loaded by the WebView. | 8.49.0 |
2285
+ | **`liveBundle`** | <code><a href="#bundleinfo">BundleInfo</a></code> | Bundle that will be restored when leaving preview mode. | 8.49.0 |
2286
+
2287
+
2288
+ ##### PreviewInfo
2289
+
2290
+ | Prop | Type | Description | Since |
2291
+ | ---------------- | ------------------------------------------------- | ------------------------------------------------------------------------- | ------ |
2292
+ | **`id`** | <code>string</code> | Preview bundle id. | 8.49.0 |
2293
+ | **`bundle`** | <code><a href="#bundleinfo">BundleInfo</a></code> | Locally downloaded bundle backing this preview. | 8.49.0 |
2294
+ | **`name`** | <code>string</code> | Human-readable name supplied when the preview was started. | 8.49.0 |
2295
+ | **`source`** | <code>string</code> | Metadata source label supplied when the preview was started. | 8.49.0 |
2296
+ | **`appId`** | <code>string</code> | Preview app id, when the session uses an app id override. | 8.49.0 |
2297
+ | **`payloadUrl`** | <code>string</code> | Payload URL used to refresh this preview. | 8.49.0 |
2298
+ | **`createdAt`** | <code>string</code> | ISO timestamp for when this preview was first saved. | 8.49.0 |
2299
+ | **`updatedAt`** | <code>string</code> | ISO timestamp for the last metadata or bundle update. | 8.49.0 |
2300
+ | **`lastUsedAt`** | <code>string</code> | ISO timestamp for the last time this preview was activated. | 8.49.0 |
2301
+ | **`isActive`** | <code>boolean</code> | Whether this preview is the currently active bundle in a preview session. | 8.49.0 |
2302
+
2303
+
2304
+ ##### DeletePreviewResult
2305
+
2306
+ | Prop | Type | Description | Since |
2307
+ | ------------- | -------------------- | ------------------------------------------------ | ------ |
2308
+ | **`removed`** | <code>boolean</code> | Whether preview metadata was removed. | 8.49.0 |
2309
+ | **`deleted`** | <code>boolean</code> | Whether the underlying local bundle was deleted. | 8.49.0 |
2310
+
2311
+
2312
+ ##### PreviewUpdateResult
2313
+
2314
+ | Prop | Type | Description | Since |
2315
+ | ------------------- | --------------------------------------------------- | --------------------------------------------------------------------- | ------ |
2316
+ | **`preview`** | <code><a href="#previewinfo">PreviewInfo</a></code> | Saved preview metadata after the check or update. | 8.49.0 |
2317
+ | **`latestVersion`** | <code>string</code> | Latest version returned by the preview payload endpoint. | 8.49.0 |
2318
+ | **`upToDate`** | <code>boolean</code> | Whether the saved preview already matches the latest payload version. | 8.49.0 |
2319
+ | **`updated`** | <code>boolean</code> | Whether a newer bundle was downloaded and saved. | 8.49.0 |
2320
+ | **`bundle`** | <code><a href="#bundleinfo">BundleInfo</a></code> | New bundle when {@link updatePreview} downloaded one. | 8.49.0 |
2321
+
2322
+
2323
+ ##### BundleListResult
2324
+
2325
+ | Prop | Type |
2326
+ | ------------- | ------------------------- |
2327
+ | **`bundles`** | <code>BundleInfo[]</code> |
2328
+
2329
+
2330
+ ##### ListOptions
2331
+
2332
+ | Prop | Type | Description | Default | Since |
2333
+ | --------- | -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ | ------ |
2334
+ | **`raw`** | <code>boolean</code> | Whether to return the raw bundle list or the manifest. If true, the list will attempt to read the internal database instead of files on disk. | <code>false</code> | 6.14.0 |
2335
+
2336
+
2337
+ ##### ResetOptions
2338
+
2339
+ | Prop | Type | Description | Default |
2340
+ | ---------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------ |
2341
+ | **`toLastSuccessful`** | <code>boolean</code> | Reset to the last successfully loaded bundle instead of the builtin one. | <code>false</code> |
2342
+ | **`usePendingBundle`** | <code>boolean</code> | Apply the pending bundle set via {@link next} while resetting. When `true`, the plugin will switch to the pending bundle immediately and clear the pending flag. If no pending bundle exists, the reset will fail. | <code>false</code> |
2343
+
2344
+
2345
+ ##### CurrentBundleResult
2346
+
2347
+ | Prop | Type |
2348
+ | ------------ | ------------------------------------------------- |
2349
+ | **`bundle`** | <code><a href="#bundleinfo">BundleInfo</a></code> |
2350
+ | **`native`** | <code>string</code> |
2351
+
2352
+
2353
+ ##### MultiDelayConditions
2354
+
2355
+ | Prop | Type | Description | Default | Since |
2356
+ | --------------------- | ----------------------------------------------------------------- | ----------------------------------------- | ------------------ | ------ |
2357
+ | **`delayConditions`** | <code>DelayCondition[]</code> | | | |
2358
+ | **`conditionMode`** | <code><a href="#delayconditionmode">DelayConditionMode</a></code> | How to combine multiple delay conditions. | <code>'and'</code> | 8.50.0 |
2359
+
2360
+
2361
+ ##### DelayCondition
2362
+
2363
+ | Prop | Type | Description |
2364
+ | ----------- | --------------------------------------------------------- | ---------------------------------------- |
2365
+ | **`kind`** | <code><a href="#delayuntilnext">DelayUntilNext</a></code> | Set up delay conditions in setMultiDelay |
2366
+ | **`value`** | <code>string</code> | |
2367
+
2368
+
2369
+ ##### TriggerUpdateCheckResult
2370
+
2371
+ Result returned after requesting an immediate native auto-update check.
2372
+
2373
+ | Prop | Type | Description |
2374
+ | ------------ | ----------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
2375
+ | **`status`** | <code>'queued' \| 'already_running' \| 'unavailable'</code> | Native trigger state: `queued` when a check was queued, `already_running` when the native update pipeline is already active, or `unavailable` on Web or when native auto-update is disabled. |
2376
+ | **`queued`** | <code>boolean</code> | Whether a new native update check was queued. This is `true` only when `status` is `queued`; otherwise it is `false`. |
2377
+
2378
+
2379
+ ##### LatestVersion
2380
+
2381
+ | Prop | Type | Description | Since |
2382
+ | ------------------ | ----------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | ------- |
2383
+ | **`version`** | <code>string</code> | Result of getLatest method | 4.0.0 |
2384
+ | **`checksum`** | <code>string</code> | | 6 |
2385
+ | **`breaking`** | <code>boolean</code> | Indicates whether the update was flagged as breaking by the backend. | 7.22.0 |
2386
+ | **`message`** | <code>string</code> | Optional message from the server. When no new version is available, this will be "No new version available". | |
2387
+ | **`sessionKey`** | <code>string</code> | | |
2388
+ | **`error`** | <code>string</code> | Error code from the server, if any. Use `kind` for classification instead of parsing this value. | |
2389
+ | **`kind`** | <code><a href="#updateresponsekind">UpdateResponseKind</a></code> | Classification for this response, provided by the backend. | 8.45.11 |
2390
+ | **`statusCode`** | <code>number</code> | HTTP status code returned by the update server for classified update-check responses. | 8.45.11 |
2391
+ | **`old`** | <code>string</code> | The previous/current version name (provided for reference). | |
2392
+ | **`url`** | <code>string</code> | Download URL for the bundle (when a new version is available). | |
2393
+ | **`manifest`** | <code>ManifestEntry[]</code> | File list for delta updates (when using multi-file downloads). | 6.1 |
2394
+ | **`missing`** | <code><a href="#getmissingbundlefilesresult">GetMissingBundleFilesResult</a></code> | Missing manifest entries for this device when {@link <a href="#getlatestoptions">GetLatestOptions.includeBundleSize</a>} is enabled. | 8.47.0 |
2395
+ | **`downloadSize`** | <code><a href="#getbundledownloadsizeresult">GetBundleDownloadSizeResult</a></code> | Estimated download size for missing manifest entries when {@link <a href="#getlatestoptions">GetLatestOptions.includeBundleSize</a>} is enabled. | 8.47.0 |
2396
+ | **`link`** | <code>string</code> | Optional link associated with this bundle version (e.g., release notes URL, changelog, GitHub release). | 7.35.0 |
2397
+ | **`comment`** | <code>string</code> | Optional comment or description for this bundle version. | 7.35.0 |
2398
+
2399
+
2400
+ ##### GetMissingBundleFilesResult
2401
+
2402
+ | Prop | Type | Description | Since |
2403
+ | ------------------- | ---------------------------- | ----------------------------------------------------------------------- | ------ |
2404
+ | **`missing`** | <code>ManifestEntry[]</code> | Entries that are not available locally and need to be downloaded. | 8.47.0 |
2405
+ | **`total`** | <code>number</code> | Total entries in the provided manifest. | 8.47.0 |
2406
+ | **`missingCount`** | <code>number</code> | Number of entries that need to be downloaded. | 8.47.0 |
2407
+ | **`reusableCount`** | <code>number</code> | Number of entries that can be reused from builtin files or local cache. | 8.47.0 |
2408
+
2409
+
2410
+ ##### GetBundleDownloadSizeResult
2411
+
2412
+ | Prop | Type | Description | Since |
2413
+ | ------------------ | ----------------------------- | --------------------------------------------------- | ------ |
2414
+ | **`totalSize`** | <code>number</code> | Sum of all known file sizes in bytes. | 8.47.0 |
2415
+ | **`knownFiles`** | <code>number</code> | Number of files with a known size. | 8.47.0 |
2416
+ | **`unknownFiles`** | <code>number</code> | Number of files whose size could not be determined. | 8.47.0 |
2417
+ | **`files`** | <code>BundleFileSize[]</code> | Per-file size results. | 8.47.0 |
2418
+
2419
+
2420
+ ##### BundleFileSize
2421
+
2422
+ | Prop | Type | Description | Since |
2423
+ | ------------------ | --------------------------- | ----------------------------------------------------------- | ------ |
2424
+ | **`file_name`** | <code>string \| null</code> | File name from the manifest entry. | 8.47.0 |
2425
+ | **`file_hash`** | <code>string \| null</code> | File hash from the manifest entry. | 8.47.0 |
2426
+ | **`download_url`** | <code>string \| null</code> | Download URL from the manifest entry. | 8.47.0 |
2427
+ | **`size`** | <code>number</code> | Estimated bytes to download when the server exposes a size. | 8.47.0 |
2428
+ | **`error`** | <code>string</code> | Error for this entry when the size could not be determined. | 8.47.0 |
2429
+
2430
+
2431
+ ##### GetLatestOptions
2432
+
2433
+ | Prop | Type | Description | Default | Since |
2434
+ | ----------------------- | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------- | ------ |
2435
+ | **`channel`** | <code>string</code> | The channel to get the latest version for The channel must allow 'self_assign' for this to work | <code>undefined</code> | 6.8.0 |
2436
+ | **`appId`** | <code>string</code> | Temporarily use another app id for this update check while using a trusted preview container. This only changes the app id sent by this request; it does not persist a preview session. Requires {@link PluginsConfig.CapacitorUpdater.allowPreview} to be `true`. | <code>undefined</code> | 8.47.0 |
2437
+ | **`includeBundleSize`** | <code>boolean</code> | When true, the native plugin computes which manifest files are missing on this device and asks the Capgo update endpoint for their stored sizes before resolving {@link getLatest}. This adds one backend request only when the update response contains a manifest. It does not perform per-file network checks. | <code>false</code> | 8.47.0 |
2438
+
2439
+
2440
+ ##### GetMissingBundleFilesOptions
2441
+
2442
+ | Prop | Type | Description | Since |
2443
+ | ---------------- | ---------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------ |
2444
+ | **`manifest`** | <code>ManifestEntry[]</code> | Manifest returned by {@link getLatest}. Passing the full {@link <a href="#latestversion">LatestVersion</a>} response is supported because it contains this field. | 8.47.0 |
2445
+ | **`version`** | <code>string</code> | Target bundle version. Passing the full {@link <a href="#latestversion">LatestVersion</a>} response is supported because it contains this field. | 8.47.0 |
2446
+ | **`sessionKey`** | <code>string</code> | Session key returned by {@link getLatest}, required only when file hashes are encrypted. | 8.47.0 |
2447
+
2448
+
2449
+ ##### GetBundleDownloadSizeOptions
2450
+
2451
+ | Prop | Type | Description | Since |
2452
+ | -------------- | ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | ------ |
2453
+ | **`manifest`** | <code>ManifestEntry[]</code> | Manifest entries to estimate. Pass `missing.missing` from {@link getMissingBundleFiles} to estimate only the bytes this device still needs to download. | 8.47.0 |
2454
+ | **`version`** | <code>string</code> | Target bundle version. Pass `latest.version` when estimating files returned by {@link getLatest}. | 8.47.0 |
2455
+
2456
+
2457
+ ##### ChannelRes
2458
+
2459
+ | Prop | Type | Description | Since |
2460
+ | ------------- | ------------------- | ----------------------------- | ----- |
2461
+ | **`status`** | <code>string</code> | Current status of set channel | 4.7.0 |
2462
+ | **`error`** | <code>string</code> | | |
2463
+ | **`message`** | <code>string</code> | | |
2464
+
2465
+
2466
+ ##### SetChannelOptions
2467
+
2468
+ | Prop | Type |
2469
+ | ----------------------- | -------------------- |
2470
+ | **`channel`** | <code>string</code> |
2471
+ | **`triggerAutoUpdate`** | <code>boolean</code> |
2472
+
2473
+
2474
+ ##### UnsetChannelOptions
2475
+
2476
+ | Prop | Type |
2477
+ | ----------------------- | -------------------- |
2478
+ | **`triggerAutoUpdate`** | <code>boolean</code> |
2479
+
2480
+
2481
+ ##### GetChannelRes
2482
+
2483
+ | Prop | Type | Description | Since |
2484
+ | -------------- | -------------------- | ----------------------------- | ----- |
2485
+ | **`channel`** | <code>string</code> | Current status of get channel | 4.8.0 |
2486
+ | **`error`** | <code>string</code> | | |
2487
+ | **`message`** | <code>string</code> | | |
2488
+ | **`status`** | <code>string</code> | | |
2489
+ | **`allowSet`** | <code>boolean</code> | | |
2490
+
2491
+
2492
+ ##### ListChannelsResult
2493
+
2494
+ | Prop | Type | Description | Since |
2495
+ | -------------- | -------------------------- | -------------------------- | ----- |
2496
+ | **`channels`** | <code>ChannelInfo[]</code> | List of available channels | 7.5.0 |
2497
+
2498
+
2499
+ ##### ChannelInfo
2500
+
2501
+ | Prop | Type | Description | Since |
2502
+ | -------------------- | -------------------- | ----------------------------------------------- | ----- |
2503
+ | **`id`** | <code>number</code> | The channel ID | 7.5.0 |
2504
+ | **`name`** | <code>string</code> | The channel name | 7.5.0 |
2505
+ | **`public`** | <code>boolean</code> | Whether this is a public channel | 7.5.0 |
2506
+ | **`allow_self_set`** | <code>boolean</code> | Whether devices can self-assign to this channel | 7.5.0 |
2507
+
2508
+
2509
+ ##### SetCustomIdOptions
2510
+
2511
+ | Prop | Type | Description |
2512
+ | -------------- | ------------------- | --------------------------------------------------------------------------------------------- |
2513
+ | **`customId`** | <code>string</code> | Custom identifier to associate with the device. Use an empty string to clear any saved value. |
2514
+
2515
+
2516
+ ##### BuiltinVersion
2517
+
2518
+ | Prop | Type |
2519
+ | ------------- | ------------------- |
2520
+ | **`version`** | <code>string</code> |
2521
+
2522
+
2523
+ ##### DeviceId
2524
+
2525
+ | Prop | Type |
2526
+ | -------------- | ------------------- |
2527
+ | **`deviceId`** | <code>string</code> |
2528
+
2529
+
2530
+ ##### PluginVersion
2531
+
2532
+ | Prop | Type |
2533
+ | ------------- | ------------------- |
2534
+ | **`version`** | <code>string</code> |
2535
+
2536
+
2537
+ ##### AutoUpdateEnabled
2538
+
2539
+ | Prop | Type |
2540
+ | ------------- | -------------------- |
2541
+ | **`enabled`** | <code>boolean</code> |
2542
+
2543
+
2544
+ ##### PluginListenerHandle
2545
+
2546
+ | Prop | Type |
2547
+ | ------------ | ----------------------------------------- |
2548
+ | **`remove`** | <code>() =&gt; Promise&lt;void&gt;</code> |
2549
+
2550
+
2551
+ ##### DownloadEvent
674
2552
 
675
2553
  | Prop | Type | Description | Since |
676
2554
  | ------------- | ------------------------------------------------- | ---------------------------------------------- | ----- |
@@ -678,113 +2556,350 @@ Remove all listeners for this plugin.
678
2556
  | **`bundle`** | <code><a href="#bundleinfo">BundleInfo</a></code> | | |
679
2557
 
680
2558
 
681
- #### noNeedEvent
2559
+ ##### NoNeedEvent
682
2560
 
683
2561
  | Prop | Type | Description | Since |
684
2562
  | ------------ | ------------------------------------------------- | ---------------------------------------------- | ----- |
685
2563
  | **`bundle`** | <code><a href="#bundleinfo">BundleInfo</a></code> | Current status of download, between 0 and 100. | 4.0.0 |
686
2564
 
687
2565
 
688
- #### updateAvailableEvent
2566
+ ##### UpdateCheckResultEvent
2567
+
2568
+ | Prop | Type | Description | Since |
2569
+ | ---------------- | ----------------------------------------------------------------- | -------------------------------------------------------------------- | ------- |
2570
+ | **`kind`** | <code><a href="#updateresponsekind">UpdateResponseKind</a></code> | Classification for the update check result, provided by the backend. | 8.45.11 |
2571
+ | **`error`** | <code>string</code> | Backend error code, when provided. | 8.45.11 |
2572
+ | **`message`** | <code>string</code> | Backend message, when provided. | 8.45.11 |
2573
+ | **`statusCode`** | <code>number</code> | HTTP status code returned by the update endpoint. | 8.45.11 |
2574
+ | **`version`** | <code>string</code> | Version referenced by the update check result. | 8.45.11 |
2575
+ | **`bundle`** | <code><a href="#bundleinfo">BundleInfo</a></code> | Current bundle on the device. | 8.45.11 |
2576
+
2577
+
2578
+ ##### UpdateAvailableEvent
689
2579
 
690
2580
  | Prop | Type | Description | Since |
691
2581
  | ------------ | ------------------------------------------------- | ---------------------------------------------- | ----- |
692
2582
  | **`bundle`** | <code><a href="#bundleinfo">BundleInfo</a></code> | Current status of download, between 0 and 100. | 4.0.0 |
693
2583
 
694
2584
 
695
- #### DownloadCompleteEvent
2585
+ ##### DownloadCompleteEvent
696
2586
 
697
2587
  | Prop | Type | Description | Since |
698
2588
  | ------------ | ------------------------------------------------- | ------------------------------------ | ----- |
699
2589
  | **`bundle`** | <code><a href="#bundleinfo">BundleInfo</a></code> | Emit when a new update is available. | 4.0.0 |
700
2590
 
701
2591
 
702
- #### MajorAvailableEvent
2592
+ ##### DownloadFailedEvent
2593
+
2594
+ | Prop | Type | Description | Since |
2595
+ | ------------- | ------------------- | -------------------------- | ----- |
2596
+ | **`version`** | <code>string</code> | Emit when a download fail. | 4.0.0 |
2597
+
2598
+
2599
+ ##### BreakingAvailableEvent
703
2600
 
704
- | Prop | Type | Description | Since |
705
- | ------------- | ------------------- | ------------------------------------------ | ----- |
706
- | **`version`** | <code>string</code> | Emit when a new major bundle is available. | 4.0.0 |
2601
+ Payload of the `breakingAvailable` {@link <a href="#updaterevent">UpdaterEvent</a>}.
707
2602
 
2603
+ | Prop | Type | Description | Since |
2604
+ | ------------- | ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------ |
2605
+ | **`version`** | <code>string</code> | Version of the breaking update that the backend blocked for this native app. This is the target version when the backend sends one. When the backend omits it, the native code can fall back to the current bundle version, so do not show this value as the required upgrade without checking that it differs from the running bundle. | 7.22.0 |
708
2606
 
709
- #### UpdateFailedEvent
2607
+
2608
+ ##### UpdateFailedEvent
710
2609
 
711
2610
  | Prop | Type | Description | Since |
712
2611
  | ------------ | ------------------------------------------------- | ------------------------------------- | ----- |
713
2612
  | **`bundle`** | <code><a href="#bundleinfo">BundleInfo</a></code> | Emit when a update failed to install. | 4.0.0 |
714
2613
 
715
2614
 
716
- #### DownloadFailedEvent
2615
+ ##### SetEvent
717
2616
 
718
- | Prop | Type | Description | Since |
719
- | ------------- | ------------------- | -------------------------- | ----- |
720
- | **`version`** | <code>string</code> | Emit when a download fail. | 4.0.0 |
2617
+ | Prop | Type | Description | Since |
2618
+ | ------------ | ------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | ------- |
2619
+ | **`bundle`** | <code><a href="#bundleinfo">BundleInfo</a></code> | Emit when a bundle has been applied successfully. This event uses native `retainUntilConsumed` behavior. | 8.43.12 |
721
2620
 
722
2621
 
723
- ### Type Aliases
2622
+ ##### SetNextEvent
724
2623
 
2624
+ | Prop | Type | Description | Since |
2625
+ | ------------ | ------------------------------------------------- | ----------------------------------------------------------- | ------ |
2626
+ | **`bundle`** | <code><a href="#bundleinfo">BundleInfo</a></code> | Emit when a bundle is queued as the next bundle to install. | 6.14.0 |
725
2627
 
726
- #### BundleStatus
727
2628
 
728
- <code>"success" | "error" | "pending" | "downloading"</code>
2629
+ ##### AppReadyEvent
729
2630
 
2631
+ | Prop | Type | Description | Since |
2632
+ | ------------ | ------------------------------------------------- | -------------------------------------------------------------------------------------------- | ----- |
2633
+ | **`bundle`** | <code><a href="#bundleinfo">BundleInfo</a></code> | Emitted when the app is ready to use. This event uses native `retainUntilConsumed` behavior. | 5.2.0 |
2634
+ | **`status`** | <code>string</code> | | |
730
2635
 
731
- #### DelayUntilNext
732
2636
 
733
- <code>"background" | "kill" | "nativeVersion" | "date"</code>
2637
+ ##### ChannelPrivateEvent
734
2638
 
2639
+ | Prop | Type | Description | Since |
2640
+ | ------------- | ------------------- | ----------------------------------------------------------------------------------- | ------ |
2641
+ | **`channel`** | <code>string</code> | Emitted when attempting to set a channel that doesn't allow device self-assignment. | 7.34.0 |
2642
+ | **`message`** | <code>string</code> | | |
735
2643
 
736
- #### DownloadChangeListener
737
2644
 
738
- <code>(state: <a href="#downloadevent">DownloadEvent</a>): void</code>
2645
+ ##### FlexibleUpdateState
739
2646
 
2647
+ State information for flexible update progress (Android only).
740
2648
 
741
- #### NoNeedListener
2649
+ | Prop | Type | Description | Since |
2650
+ | -------------------------- | ----------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ----- |
2651
+ | **`installStatus`** | <code><a href="#flexibleupdateinstallstatus">FlexibleUpdateInstallStatus</a></code> | The current installation status. | 8.0.0 |
2652
+ | **`bytesDownloaded`** | <code>number</code> | Number of bytes downloaded so far. Only available during the `DOWNLOADING` status. | 8.0.0 |
2653
+ | **`totalBytesToDownload`** | <code>number</code> | Total number of bytes to download. Only available during the `DOWNLOADING` status. | 8.0.0 |
742
2654
 
743
- <code>(state: <a href="#noneedevent">noNeedEvent</a>): void</code>
744
2655
 
2656
+ ##### AutoUpdateAvailable
745
2657
 
746
- #### UpdateAvailabledListener
2658
+ | Prop | Type |
2659
+ | --------------- | -------------------- |
2660
+ | **`available`** | <code>boolean</code> |
747
2661
 
748
- <code>(state: <a href="#updateavailableevent">updateAvailableEvent</a>): void</code>
749
2662
 
2663
+ ##### SetShakeMenuOptions
750
2664
 
751
- #### DownloadCompleteListener
2665
+ | Prop | Type |
2666
+ | ------------- | -------------------- |
2667
+ | **`enabled`** | <code>boolean</code> |
752
2668
 
753
- <code>(state: <a href="#downloadcompleteevent">DownloadCompleteEvent</a>): void</code>
754
2669
 
2670
+ ##### ShakeMenuEnabled
755
2671
 
756
- #### MajorAvailableListener
2672
+ | Prop | Type | Description | Since |
2673
+ | ------------- | ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------ |
2674
+ | **`enabled`** | <code>boolean</code> | | |
2675
+ | **`gesture`** | <code><a href="#shakemenugesture">ShakeMenuGesture</a></code> | The currently configured native gesture used to open the preview/channel menu. Undefined means consumers should treat the gesture as the default `shake` behavior. | 8.48.0 |
757
2676
 
758
- <code>(state: <a href="#majoravailableevent">MajorAvailableEvent</a>): void</code>
759
2677
 
2678
+ ##### SetShakeChannelSelectorOptions
760
2679
 
761
- #### UpdateFailedListener
2680
+ | Prop | Type |
2681
+ | ------------- | -------------------- |
2682
+ | **`enabled`** | <code>boolean</code> |
762
2683
 
763
- <code>(state: <a href="#updatefailedevent">UpdateFailedEvent</a>): void</code>
764
2684
 
2685
+ ##### ShakeChannelSelectorEnabled
765
2686
 
766
- #### DownloadFailedListener
2687
+ | Prop | Type |
2688
+ | ------------- | -------------------- |
2689
+ | **`enabled`** | <code>boolean</code> |
767
2690
 
768
- <code>(state: <a href="#downloadfailedevent">DownloadFailedEvent</a>): void</code>
769
2691
 
2692
+ ##### GetAppIdRes
770
2693
 
771
- #### AppReloadedListener
2694
+ | Prop | Type |
2695
+ | ----------- | ------------------- |
2696
+ | **`appId`** | <code>string</code> |
772
2697
 
773
- <code>(state: void): void</code>
2698
+
2699
+ ##### SetAppIdOptions
2700
+
2701
+ | Prop | Type |
2702
+ | ----------- | ------------------- |
2703
+ | **`appId`** | <code>string</code> |
2704
+
2705
+
2706
+ ##### AppUpdateInfo
2707
+
2708
+ Information about app updates available in the App Store or Play Store.
2709
+
2710
+ | Prop | Type | Description | Since |
2711
+ | --------------------------------- | ----------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----- |
2712
+ | **`currentVersionName`** | <code>string</code> | The currently installed version name (e.g., "1.2.3"). | 8.0.0 |
2713
+ | **`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 |
2714
+ | **`currentVersionCode`** | <code>string</code> | The currently installed version code (Android) or build number (iOS). | 8.0.0 |
2715
+ | **`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 |
2716
+ | **`availableVersionReleaseDate`** | <code>string</code> | The release date of the available version (iOS only). Format: ISO 8601 date string. | 8.0.0 |
2717
+ | **`updateAvailability`** | <code><a href="#appupdateavailability">AppUpdateAvailability</a></code> | The current update availability status. | 8.0.0 |
2718
+ | **`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 |
2719
+ | **`immediateUpdateAllowed`** | <code>boolean</code> | Whether an immediate update is allowed (Android only). If `true`, you can call {@link CapacitorUpdaterPlugin.performImmediateUpdate}. | 8.0.0 |
2720
+ | **`flexibleUpdateAllowed`** | <code>boolean</code> | Whether a flexible update is allowed (Android only). If `true`, you can call {@link CapacitorUpdaterPlugin.startFlexibleUpdate}. | 8.0.0 |
2721
+ | **`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 |
2722
+ | **`installStatus`** | <code><a href="#flexibleupdateinstallstatus">FlexibleUpdateInstallStatus</a></code> | The current install status of a flexible update (Android only). | 8.0.0 |
2723
+ | **`minimumOsVersion`** | <code>string</code> | The minimum OS version required for the available update (iOS only). | 8.0.0 |
2724
+
2725
+
2726
+ ##### GetAppUpdateInfoOptions
2727
+
2728
+ Options for {@link CapacitorUpdaterPlugin.getAppUpdateInfo}.
2729
+
2730
+ | Prop | Type | Description | Since |
2731
+ | ------------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
2732
+ | **`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 |
2733
+
2734
+
2735
+ ##### OpenAppStoreOptions
2736
+
2737
+ Options for {@link CapacitorUpdaterPlugin.openAppStore}.
2738
+
2739
+ | Prop | Type | Description | Since |
2740
+ | ----------------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----- |
2741
+ | **`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 |
2742
+ | **`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 |
2743
+
2744
+
2745
+ ##### AppUpdateResult
2746
+
2747
+ Result of an app update operation.
2748
+
2749
+ | Prop | Type | Description | Since |
2750
+ | ---------- | ------------------------------------------------------------------- | ---------------------------------------- | ----- |
2751
+ | **`code`** | <code><a href="#appupdateresultcode">AppUpdateResultCode</a></code> | The result code of the update operation. | 8.0.0 |
2752
+
2753
+
2754
+ #### Type Aliases
2755
+
2756
+
2757
+ ##### BundleStatus
2758
+
2759
+ pending: The bundle is pending to be **SET** as the next bundle.
2760
+ downloading: The bundle is being downloaded.
2761
+ success: The bundle has been downloaded and is ready to be **SET** as the next bundle.
2762
+ error: The bundle has failed to download.
2763
+
2764
+ <code>'success' | 'error' | 'pending' | 'downloading' | 'deleted' | 'deleting'</code>
2765
+
2766
+
2767
+ ##### DelayUntilNext
2768
+
2769
+ <code>'background' | 'kill' | 'nativeVersion' | 'date'</code>
2770
+
2771
+
2772
+ ##### DelayConditionMode
2773
+
2774
+ How multiple delay conditions are combined when more than one is set.
2775
+
2776
+ - `and`: every condition must be satisfied before the pending update is applied (default, backward compatible).
2777
+ - `or`: the pending update is applied as soon as any condition is satisfied.
2778
+
2779
+ <code>'and' | 'or'</code>
2780
+
2781
+
2782
+ ##### UpdateResponseKind
2783
+
2784
+ Classification for update-check responses that do not provide a downloadable bundle.
2785
+ The update backend provides this field directly. Missing or unknown values are treated as
2786
+ failed by native clients.
2787
+
2788
+ <code>'up_to_date' | 'blocked' | 'failed'</code>
2789
+
2790
+
2791
+ ##### UpdaterEvent
2792
+
2793
+ Payload of the single `updaterEvent` listener: every plugin event as `{ type, data }`.
2794
+ Switch on `type` to get a typed `data`.
2795
+
2796
+ - `download`: download progress of a bundle, from start to finish (`percent` between 0 and 100).
2797
+ - `noNeedUpdate`: the update pipeline run completed. It does not mean nothing is pending: a bundle can already be
2798
+ downloaded and waiting (iOS can queue one to apply on background), so use `getNextBundle()` for what is queued
2799
+ and `updateCheckResult.kind` for the backend's classification. `data.bundle` is usually the running
2800
+ bundle, but after a download waiting on install conditions (for example `autoUpdate: 'always'` with delay
2801
+ conditions) it is that downloaded bundle, not the active one; use `current()` for the running bundle.
2802
+ It is not proof that no update existed (it also follows a blocked check and a background install).
2803
+ Retained natively until a listener consumes it.
2804
+ - `updateCheckResult`: classified result of an update check, before the updater decides whether to download.
2805
+ In the background update pipeline, `up_to_date` and `blocked` are emitted before `noNeedUpdate` and no
2806
+ `downloadFailed` follows. A `failed` result is emitted before `downloadFailed`, and native code sends an
2807
+ `update_check_error` stat instead of `download_fail` because no bundle download was attempted.
2808
+ Periodic checks (`periodCheckDelay`) may emit only `updateCheckResult`, without those follow-up events or stats.
2809
+ - `updateAvailable`: a new bundle is downloaded and ready. When `autoUpdate` is `onlyDownload`, the one from the
2810
+ automatic update is retained natively until a listener consumes it, because the app must apply that bundle
2811
+ itself. Do not rely on retention for one from a manual `download()` (iOS does not retain it).
2812
+ - `downloadComplete`: a bundle download finished.
2813
+ - `downloadFailed`: a bundle download or update check failed.
2814
+ - `breakingAvailable`: the backend blocked an update as incompatible with the current native app.
2815
+ - `updateFailed`: a bundle failed its readiness check (no `notifyAppReady()` in time) and was rolled back. This happens
2816
+ at the next app start or after an in-session reload (for example `set()`, `next()` applied on background, or an
2817
+ instant apply update).
2818
+ - `set`: a bundle was applied. Retained natively until a listener consumes it.
2819
+ - `setNext`: a bundle was queued as the next bundle to install.
2820
+ - `appReloaded`: the app reloaded.
2821
+ - `appReady`: the app is ready to use. Retained natively until a listener consumes it.
2822
+ - `channelPrivate`: `setChannel()` targeted a channel that does not allow device self-assignment.
2823
+ - `onFlexibleUpdateStateChange`: Android flexible in-app update progress and install status.
2824
+ `installStatus` is numeric: when it equals <a href="#flexibleupdateinstallstatus">`FlexibleUpdateInstallStatus.DOWNLOADED`</a> (`11`), prompt the user and call
2825
+ {@link CapacitorUpdaterPlugin.completeFlexibleUpdate}.
2826
+
2827
+ <code>{ type: 'download'; data: <a href="#downloadevent">DownloadEvent</a> } | { type: 'noNeedUpdate'; data: <a href="#noneedevent">NoNeedEvent</a> } | { type: 'updateCheckResult'; data: <a href="#updatecheckresultevent">UpdateCheckResultEvent</a> } | { type: 'updateAvailable'; data: <a href="#updateavailableevent">UpdateAvailableEvent</a> } | { type: 'downloadComplete'; data: <a href="#downloadcompleteevent">DownloadCompleteEvent</a> } | { type: 'downloadFailed'; data: <a href="#downloadfailedevent">DownloadFailedEvent</a> } | { type: 'breakingAvailable'; data: <a href="#breakingavailableevent">BreakingAvailableEvent</a> } | { type: 'updateFailed'; data: <a href="#updatefailedevent">UpdateFailedEvent</a> } | { type: 'set'; data: <a href="#setevent">SetEvent</a> } | { type: 'setNext'; data: <a href="#setnextevent">SetNextEvent</a> } | { type: 'appReloaded'; data: <a href="#record">Record</a>&lt;string, never&gt; } | { type: 'appReady'; data: <a href="#appreadyevent">AppReadyEvent</a> } | { type: 'channelPrivate'; data: <a href="#channelprivateevent">ChannelPrivateEvent</a> } | { type: 'onFlexibleUpdateStateChange'; data: <a href="#flexibleupdatestate">FlexibleUpdateState</a> }</code>
2828
+
2829
+
2830
+ ##### Record
2831
+
2832
+ Construct a type with a set of properties K of type T
2833
+
2834
+ <code>{
2835
+ [P in K]: T;
2836
+ }</code>
2837
+
2838
+
2839
+ ##### ShakeMenuGesture
2840
+
2841
+ Native gesture options that open the shake menu.
2842
+
2843
+ Supported values are `shake` and `threeFingerPinch`.
2844
+
2845
+ <code>'shake' | 'threeFingerPinch'</code>
2846
+
2847
+
2848
+ #### Enums
2849
+
2850
+
2851
+ ##### FlexibleUpdateInstallStatus
2852
+
2853
+ | Members | Value | Description |
2854
+ | ----------------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------ |
2855
+ | **`UNKNOWN`** | <code>0</code> | Unknown install status. |
2856
+ | **`PENDING`** | <code>1</code> | Download is pending and will start soon. |
2857
+ | **`DOWNLOADING`** | <code>2</code> | Download is in progress. Check `bytesDownloaded` and `totalBytesToDownload` for progress. |
2858
+ | **`INSTALLING`** | <code>3</code> | The update is being installed. |
2859
+ | **`INSTALLED`** | <code>4</code> | The update has been installed. The app needs to be restarted to use the new version. |
2860
+ | **`FAILED`** | <code>5</code> | The update failed to download or install. |
2861
+ | **`CANCELED`** | <code>6</code> | The update was canceled by the user. |
2862
+ | **`DOWNLOADED`** | <code>11</code> | The update has been downloaded and is ready to install. Call {@link CapacitorUpdaterPlugin.completeFlexibleUpdate} to install. |
2863
+
2864
+
2865
+ ##### AppUpdateAvailability
2866
+
2867
+ | Members | Value | Description |
2868
+ | -------------------------- | -------------- | ------------------------------------------------------------------------------------------ |
2869
+ | **`UNKNOWN`** | <code>0</code> | Update availability is unknown. This typically means the check hasn't completed or failed. |
2870
+ | **`UPDATE_NOT_AVAILABLE`** | <code>1</code> | No update is available. The installed version is the latest. |
2871
+ | **`UPDATE_AVAILABLE`** | <code>2</code> | An update is available for download. |
2872
+ | **`UPDATE_IN_PROGRESS`** | <code>3</code> | An update is currently being downloaded or installed. |
2873
+
2874
+
2875
+ ##### AppUpdateResultCode
2876
+
2877
+ | Members | Value | Description |
2878
+ | ------------------- | -------------- | --------------------------------------------------------------------------------------------------------------------------- |
2879
+ | **`OK`** | <code>0</code> | The update completed successfully. |
2880
+ | **`CANCELED`** | <code>1</code> | The user canceled the update. |
2881
+ | **`FAILED`** | <code>2</code> | The update failed. |
2882
+ | **`NOT_AVAILABLE`** | <code>3</code> | No update is available. |
2883
+ | **`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. |
2884
+ | **`INFO_MISSING`** | <code>5</code> | Required information is missing. This can happen if {@link CapacitorUpdaterPlugin.getAppUpdateInfo} wasn't called first. |
774
2885
 
775
2886
  </docgen-api>
776
2887
 
777
2888
  ### Listen to download events
778
2889
 
779
- ```javascript
780
- import { CapacitorUpdater } from '@capgo/capacitor-updater';
2890
+ Every plugin event arrives through the single `updaterEvent` listener as `{ type, data }`:
2891
+
2892
+ ```typescript
2893
+ import { CapacitorUpdater } from '@capgo/capacitor-updater';
781
2894
 
782
- CapacitorUpdater.addListener('download', (info: any) => {
783
- console.log('download was fired', info.percent);
2895
+ CapacitorUpdater.addListener('updaterEvent', (event) => {
2896
+ if (event.type === 'download') {
2897
+ console.log('download was fired', event.data.percent);
2898
+ }
784
2899
  });
785
2900
  ```
786
2901
 
787
- On iOS, Apple don't allow you to show a message when the app is updated, so you can't show a progress bar.
2902
+ On iOS, a progress bar is fine. Do not label it as an update, a live update, a remote update, or a download, and do not add an "Apply update" button. Describe the wait as tailoring the experience, for example "Tailoring your experience…". If the user must continue, ask them to reopen the app. See [Good practice for App Store review](#good-practice-for-app-store-review).
788
2903
 
789
2904
  ### Inspiration
790
2905
 
@@ -794,4 +2909,4 @@ On iOS, Apple don't allow you to show a message when the app is updated, so you
794
2909
 
795
2910
  ### Contributors
796
2911
 
797
- [jamesyoung1337](https://github.com/jamesyoung1337) Thanks a lot for your guidance and support, it was impossible to make this plugin work without you.
2912
+ [jamesyoung1337](https://github.com/jamesyoung1337) Thank you so much for your guidance and support, it was impossible to make this plugin work without you.