@capgo/capacitor-updater 9.0.0 → 9.0.1

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