@capgo/capacitor-updater 6.25.7 → 6.27.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -440,9 +440,32 @@ export default config;
440
440
  notifyAppReady() => Promise<AppReadyResult>
441
441
  ```
442
442
 
443
- Notify Capacitor Updater that the current bundle is working (a rollback will occur if this method is not called on every app launch)
444
- By default this method should be called in the first 10 sec after app launch, otherwise a rollback will occur.
445
- Change this behaviour with {@link appReadyTimeout}
443
+ Notify the native layer that JavaScript initialized successfully.
444
+
445
+ **CRITICAL: You must call this method on every app launch to prevent automatic rollback.**
446
+
447
+ This is a simple notification to confirm that your bundle's JavaScript loaded and executed.
448
+ The native web server successfully served the bundle files and your JS runtime started.
449
+ That's all it checks - nothing more complex.
450
+
451
+ **What triggers rollback:**
452
+ - NOT calling this method within the timeout (default: 10 seconds)
453
+ - Complete JavaScript failure (bundle won't load at all)
454
+
455
+ **What does NOT trigger rollback:**
456
+ - Runtime errors after initialization (API failures, crashes, etc.)
457
+ - Network request failures
458
+ - Application logic errors
459
+
460
+ **IMPORTANT: Call this BEFORE any network requests.**
461
+ Don't wait for APIs, data loading, or async operations. Call it as soon as your
462
+ JavaScript bundle starts executing to confirm the bundle itself is valid.
463
+
464
+ Best practices:
465
+ - Call immediately in your app entry point (main.js, app component mount, etc.)
466
+ - Don't put it after network calls or heavy initialization
467
+ - Don't wrap it in try/catch with conditions
468
+ - Adjust {@link PluginsConfig.CapacitorUpdater.appReadyTimeout} if you need more time
446
469
 
447
470
  **Returns:** <code>Promise&lt;<a href="#appreadyresult">AppReadyResult</a>&gt;</code>
448
471
 
@@ -455,11 +478,17 @@ Change this behaviour with {@link appReadyTimeout}
455
478
  setUpdateUrl(options: UpdateUrl) => Promise<void>
456
479
  ```
457
480
 
458
- Set the updateUrl for the app, this will be used to check for updates.
481
+ Set the update URL for the app dynamically at runtime.
482
+
483
+ This overrides the {@link PluginsConfig.CapacitorUpdater.updateUrl} config value.
484
+ Requires {@link PluginsConfig.CapacitorUpdater.allowModifyUrl} to be set to `true`.
485
+
486
+ Use {@link PluginsConfig.CapacitorUpdater.persistModifyUrl} to persist this value across app restarts.
487
+ Otherwise, the URL will reset to the config value on next app launch.
459
488
 
460
489
  | Param | Type | Description |
461
490
  | ------------- | ----------------------------------------------- | ------------------------------------------------- |
462
- | **`options`** | <code><a href="#updateurl">UpdateUrl</a></code> | contains the URL to use for checking for updates. |
491
+ | **`options`** | <code><a href="#updateurl">UpdateUrl</a></code> | Contains the URL to use for checking for updates. |
463
492
 
464
493
  **Since:** 5.4.0
465
494
 
@@ -472,11 +501,17 @@ Set the updateUrl for the app, this will be used to check for updates.
472
501
  setStatsUrl(options: StatsUrl) => Promise<void>
473
502
  ```
474
503
 
475
- Set the statsUrl for the app, this will be used to send statistics. Passing an empty string will disable statistics gathering.
504
+ Set the statistics URL for the app dynamically at runtime.
505
+
506
+ This overrides the {@link PluginsConfig.CapacitorUpdater.statsUrl} config value.
507
+ Requires {@link PluginsConfig.CapacitorUpdater.allowModifyUrl} to be set to `true`.
508
+
509
+ Pass an empty string to disable statistics gathering entirely.
510
+ Use {@link PluginsConfig.CapacitorUpdater.persistModifyUrl} to persist this value across app restarts.
476
511
 
477
- | Param | Type | Description |
478
- | ------------- | --------------------------------------------- | ----------------------------------------------- |
479
- | **`options`** | <code><a href="#statsurl">StatsUrl</a></code> | contains the URL to use for sending statistics. |
512
+ | Param | Type | Description |
513
+ | ------------- | --------------------------------------------- | ------------------------------------------------------------------------------ |
514
+ | **`options`** | <code><a href="#statsurl">StatsUrl</a></code> | Contains the URL to use for sending statistics, or an empty string to disable. |
480
515
 
481
516
  **Since:** 5.4.0
482
517
 
@@ -489,11 +524,17 @@ Set the statsUrl for the app, this will be used to send statistics. Passing an e
489
524
  setChannelUrl(options: ChannelUrl) => Promise<void>
490
525
  ```
491
526
 
492
- Set the channelUrl for the app, this will be used to set the channel.
527
+ Set the channel URL for the app dynamically at runtime.
493
528
 
494
- | Param | Type | Description |
495
- | ------------- | ------------------------------------------------- | ------------------------------------------------ |
496
- | **`options`** | <code><a href="#channelurl">ChannelUrl</a></code> | contains the URL to use for setting the channel. |
529
+ This overrides the {@link PluginsConfig.CapacitorUpdater.channelUrl} config value.
530
+ Requires {@link PluginsConfig.CapacitorUpdater.allowModifyUrl} to be set to `true`.
531
+
532
+ Use {@link PluginsConfig.CapacitorUpdater.persistModifyUrl} to persist this value across app restarts.
533
+ Otherwise, the URL will reset to the config value on next app launch.
534
+
535
+ | Param | Type | Description |
536
+ | ------------- | ------------------------------------------------- | ----------------------------------------------- |
537
+ | **`options`** | <code><a href="#channelurl">ChannelUrl</a></code> | Contains the URL to use for channel operations. |
497
538
 
498
539
  **Since:** 5.4.0
499
540
 
@@ -506,7 +547,20 @@ Set the channelUrl for the app, this will be used to set the channel.
506
547
  download(options: DownloadOptions) => Promise<BundleInfo>
507
548
  ```
508
549
 
509
- 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
550
+ Download a new bundle from the provided URL for later installation.
551
+
552
+ The downloaded bundle is stored locally but not activated. To use it:
553
+ - Call {@link next} to set it for installation on next app backgrounding/restart
554
+ - Call {@link set} to activate it immediately (destroys current JavaScript context)
555
+
556
+ The URL should point to a zip file containing either:
557
+ - Your app files directly in the zip root, or
558
+ - A single folder containing all your app files
559
+
560
+ The bundle must include an `index.html` file at the root level.
561
+
562
+ For encrypted bundles, provide the `sessionKey` and `checksum` parameters.
563
+ For multi-file partial updates, provide the `manifest` array.
510
564
 
511
565
  | Param | Type | Description |
512
566
  | ------------- | ----------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
@@ -523,11 +577,22 @@ Download a new bundle from the provided URL, it should be a zip file, with files
523
577
  next(options: BundleId) => Promise<BundleInfo>
524
578
  ```
525
579
 
526
- Set the next bundle to be used when the app is reloaded.
580
+ Set the next bundle to be activated when the app backgrounds or restarts.
581
+
582
+ This is the recommended way to apply updates as it doesn't interrupt the user's current session.
583
+ The bundle will be activated when:
584
+ - The app is backgrounded (user switches away), or
585
+ - The app is killed and relaunched, or
586
+ - {@link reload} is called manually
587
+
588
+ Unlike {@link set}, this method does NOT destroy the current JavaScript context immediately.
589
+ Your app continues running normally until one of the above events occurs.
590
+
591
+ Use {@link setMultiDelay} to add additional conditions before the update is applied.
527
592
 
528
- | Param | Type | Description |
529
- | ------------- | --------------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
530
- | **`options`** | <code><a href="#bundleid">BundleId</a></code> | Contains the ID of the next Bundle to set on next app launch. {@link <a href="#bundleinfo">BundleInfo.id</a>} |
593
+ | Param | Type | Description |
594
+ | ------------- | --------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
595
+ | **`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. |
531
596
 
532
597
  **Returns:** <code>Promise&lt;<a href="#bundleinfo">BundleInfo</a>&gt;</code>
533
598
 
@@ -542,6 +607,22 @@ set(options: BundleId) => Promise<void>
542
607
 
543
608
  Set the current bundle and immediately reloads the app.
544
609
 
610
+ **IMPORTANT: This is a terminal operation that destroys the current JavaScript context.**
611
+
612
+ When you call this method:
613
+ - The entire JavaScript context is immediately destroyed
614
+ - The app reloads from a different folder with different files
615
+ - NO code after this call will execute
616
+ - NO promises will resolve
617
+ - NO callbacks will fire
618
+ - Event listeners registered after this call are unreliable and may never fire
619
+
620
+ The reload happens automatically - you don't need to do anything else.
621
+ If you need to preserve state like the current URL path, use the {@link PluginsConfig.CapacitorUpdater.keepUrlPathAfterReload} config option.
622
+ For other state preservation needs, save your data before calling this method (e.g., to localStorage).
623
+
624
+ **Do not** try to execute additional logic after calling `set()` - it won't work as expected.
625
+
545
626
  | Param | Type | Description |
546
627
  | ------------- | --------------------------------------------- | ------------------------------------------------------------------------------------------------- |
547
628
  | **`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. |
@@ -555,11 +636,21 @@ Set the current bundle and immediately reloads the app.
555
636
  delete(options: BundleId) => Promise<void>
556
637
  ```
557
638
 
558
- Deletes the specified bundle from the native app storage. Use with {@link list} to get the stored Bundle IDs.
639
+ Delete a bundle from local storage to free up disk space.
640
+
641
+ You cannot delete:
642
+ - The currently active bundle
643
+ - The `builtin` bundle (the version shipped with your app)
644
+ - The bundle set as `next` (call {@link next} with a different bundle first)
645
+
646
+ Use {@link list} to get all available bundle IDs.
559
647
 
560
- | Param | Type | Description |
561
- | ------------- | --------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
562
- | **`options`** | <code><a href="#bundleid">BundleId</a></code> | A {@link <a href="#bundleid">BundleId</a>} object containing the ID of a bundle to delete (note, this is the bundle id, NOT the version name) |
648
+ **Note:** The bundle ID is NOT the same as the version name.
649
+ Use the `id` field from {@link <a href="#bundleinfo">BundleInfo</a>}, not the `version` field.
650
+
651
+ | Param | Type | Description |
652
+ | ------------- | --------------------------------------------- | ------------------------------------------------------------------------------------- |
653
+ | **`options`** | <code><a href="#bundleid">BundleId</a></code> | A {@link <a href="#bundleid">BundleId</a>} object containing the bundle ID to delete. |
563
654
 
564
655
  --------------------
565
656
 
@@ -570,11 +661,22 @@ Deletes the specified bundle from the native app storage. Use with {@link list}
570
661
  setBundleError(options: BundleId) => Promise<BundleInfo>
571
662
  ```
572
663
 
573
- Mark an installed bundle as errored. Only available when {@link PluginsConfig.CapacitorUpdater.allowManualBundleError} is true.
664
+ Manually mark a bundle as failed/errored in manual update mode.
665
+
666
+ This is useful when you detect that a bundle has critical issues and want to prevent
667
+ it from being used again. The bundle status will be changed to `error` and the plugin
668
+ will avoid using this bundle in the future.
669
+
670
+ **Requirements:**
671
+ - {@link PluginsConfig.CapacitorUpdater.allowManualBundleError} must be set to `true`
672
+ - Only works in manual update mode (when autoUpdate is disabled)
673
+
674
+ Common use case: After downloading and testing a bundle, you discover it has critical
675
+ bugs and want to mark it as failed so it won't be retried.
574
676
 
575
677
  | Param | Type | Description |
576
678
  | ------------- | --------------------------------------------- | ---------------------------------------------------------------------------------------------- |
577
- | **`options`** | <code><a href="#bundleid">BundleId</a></code> | A {@link <a href="#bundleid">BundleId</a>} object containing the bundle id to mark as errored. |
679
+ | **`options`** | <code><a href="#bundleid">BundleId</a></code> | A {@link <a href="#bundleid">BundleId</a>} object containing the bundle ID to mark as errored. |
578
680
 
579
681
  **Returns:** <code>Promise&lt;<a href="#bundleinfo">BundleInfo</a>&gt;</code>
580
682
 
@@ -589,11 +691,22 @@ Mark an installed bundle as errored. Only available when {@link PluginsConfig.Ca
589
691
  list(options?: ListOptions | undefined) => Promise<BundleListResult>
590
692
  ```
591
693
 
592
- Get all locally downloaded bundles in your app
694
+ Get all locally downloaded bundles stored in your app.
695
+
696
+ This returns all bundles that have been downloaded and are available locally, including:
697
+ - The currently active bundle
698
+ - The `builtin` bundle (shipped with your app)
699
+ - Any downloaded bundles waiting to be activated
700
+ - Failed bundles (with `error` status)
701
+
702
+ Use this to:
703
+ - Check available disk space by counting bundles
704
+ - Delete old bundles with {@link delete}
705
+ - Monitor bundle download status
593
706
 
594
- | Param | Type | Description |
595
- | ------------- | --------------------------------------------------- | ---------------------------------------------------------------------- |
596
- | **`options`** | <code><a href="#listoptions">ListOptions</a></code> | The {@link <a href="#listoptions">ListOptions</a>} for listing bundles |
707
+ | Param | Type | Description |
708
+ | ------------- | --------------------------------------------------- | ------------------------------------------------------------------------------------------ |
709
+ | **`options`** | <code><a href="#listoptions">ListOptions</a></code> | The {@link <a href="#listoptions">ListOptions</a>} for customizing the bundle list output. |
597
710
 
598
711
  **Returns:** <code>Promise&lt;<a href="#bundlelistresult">BundleListResult</a>&gt;</code>
599
712
 
@@ -606,11 +719,23 @@ Get all locally downloaded bundles in your app
606
719
  reset(options?: ResetOptions | undefined) => Promise<void>
607
720
  ```
608
721
 
609
- Reset the app to the `builtin` bundle (the one sent to Apple App Store / Google Play Store ) or the last successfully loaded bundle.
722
+ Reset the app to a known good bundle.
610
723
 
611
- | Param | Type | Description |
612
- | ------------- | ----------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
613
- | **`options`** | <code><a href="#resetoptions">ResetOptions</a></code> | Containing {@link <a href="#resetoptions">ResetOptions.toLastSuccessful</a>}, `true` resets to the builtin bundle and `false` will reset to the last successfully loaded bundle. |
724
+ This method helps recover from problematic updates by reverting to either:
725
+ - The `builtin` bundle (the original version shipped with your app to App Store/Play Store)
726
+ - The last successfully loaded bundle (most recent bundle that worked correctly)
727
+
728
+ **IMPORTANT: This triggers an immediate app reload, destroying the current JavaScript context.**
729
+ See {@link set} for details on the implications of this operation.
730
+
731
+ Use cases:
732
+ - Emergency recovery when an update causes critical issues
733
+ - Testing rollback functionality
734
+ - Providing users a "reset to factory" option
735
+
736
+ | Param | Type |
737
+ | ------------- | ----------------------------------------------------- |
738
+ | **`options`** | <code><a href="#resetoptions">ResetOptions</a></code> |
614
739
 
615
740
  --------------------
616
741
 
@@ -621,7 +746,20 @@ Reset the app to the `builtin` bundle (the one sent to Apple App Store / Google
621
746
  current() => Promise<CurrentBundleResult>
622
747
  ```
623
748
 
624
- Get the current bundle, if none are set it returns `builtin`. currentNative is the original bundle installed on the device
749
+ Get information about the currently active bundle.
750
+
751
+ Returns:
752
+ - `bundle`: The currently active bundle information
753
+ - `native`: The version of the builtin bundle (the original app version from App/Play Store)
754
+
755
+ If no updates have been applied, `bundle.id` will be `"builtin"`, indicating the app
756
+ is running the original version shipped with the native app.
757
+
758
+ Use this to:
759
+ - Display the current version to users
760
+ - Check if an update is currently active
761
+ - Compare against available updates
762
+ - Log the active bundle for debugging
625
763
 
626
764
  **Returns:** <code>Promise&lt;<a href="#currentbundleresult">CurrentBundleResult</a>&gt;</code>
627
765
 
@@ -634,7 +772,20 @@ Get the current bundle, if none are set it returns `builtin`. currentNative is t
634
772
  reload() => Promise<void>
635
773
  ```
636
774
 
637
- Reload the view
775
+ Manually reload the app to apply a pending update.
776
+
777
+ This triggers the same reload behavior that happens automatically when the app backgrounds.
778
+ If you've called {@link next} to queue an update, calling `reload()` will apply it immediately.
779
+
780
+ **IMPORTANT: This destroys the current JavaScript context immediately.**
781
+ See {@link set} for details on the implications of this operation.
782
+
783
+ Common use cases:
784
+ - Applying an update immediately after download instead of waiting for backgrounding
785
+ - Providing a "Restart now" button to users after an update is ready
786
+ - Testing update flows during development
787
+
788
+ If no update is pending (no call to {@link next}), this simply reloads the current bundle.
638
789
 
639
790
  --------------------
640
791
 
@@ -645,17 +796,26 @@ Reload the view
645
796
  setMultiDelay(options: MultiDelayConditions) => Promise<void>
646
797
  ```
647
798
 
648
- Sets a {@link <a href="#delaycondition">DelayCondition</a>} array containing conditions that the Plugin will use to delay the update.
649
- After all conditions are met, the update process will run start again as usual, so update will be installed after a backgrounding or killing the app.
650
- For the `date` kind, the value should be an iso8601 date string.
651
- For the `background` kind, the value should be a number in milliseconds.
652
- For the `nativeVersion` kind, the value should be the version number.
653
- For the `kill` kind, the value is not used.
654
- The function has inconsistent behavior the option kill do trigger the update after the first kill and not after the next background like other options. This will be fixed in a future major release.
799
+ Configure conditions that must be met before a pending update is applied.
800
+
801
+ After calling {@link next} to queue an update, use this method to control when it gets applied.
802
+ The update will only be installed after ALL specified conditions are satisfied.
803
+
804
+ Available condition types:
805
+ - `background`: Wait for the app to be backgrounded. Optionally specify duration in milliseconds.
806
+ - `kill`: Wait for the app to be killed and relaunched (**Note:** Current behavior triggers update immediately on kill, not on next background. This will be fixed in v8.)
807
+ - `date`: Wait until a specific date/time (ISO 8601 format)
808
+ - `nativeVersion`: Wait until the native app is updated to a specific version
655
809
 
656
- | Param | Type | Description |
657
- | ------------- | --------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
658
- | **`options`** | <code><a href="#multidelayconditions">MultiDelayConditions</a></code> | Containing the {@link <a href="#multidelayconditions">MultiDelayConditions</a>} array of conditions to set |
810
+ Condition value formats:
811
+ - `background`: Number in milliseconds (e.g., `"300000"` for 5 minutes), or omit for immediate
812
+ - `kill`: No value needed
813
+ - `date`: ISO 8601 date string (e.g., `"2025-12-31T23:59:59Z"`)
814
+ - `nativeVersion`: Version string (e.g., `"2.0.0"`)
815
+
816
+ | Param | Type | Description |
817
+ | ------------- | --------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
818
+ | **`options`** | <code><a href="#multidelayconditions">MultiDelayConditions</a></code> | Contains the {@link <a href="#multidelayconditions">MultiDelayConditions</a>} array of conditions. |
659
819
 
660
820
  **Since:** 4.3.0
661
821
 
@@ -668,7 +828,15 @@ The function has inconsistent behavior the option kill do trigger the update aft
668
828
  cancelDelay() => Promise<void>
669
829
  ```
670
830
 
671
- Cancels a {@link <a href="#delaycondition">DelayCondition</a>} to process an update immediately.
831
+ Cancel all delay conditions and apply the pending update immediately.
832
+
833
+ If you've set delay conditions with {@link setMultiDelay}, this method clears them
834
+ and triggers the pending update to be applied on the next app background or restart.
835
+
836
+ This is useful when:
837
+ - User manually requests to update now (e.g., clicks "Update now" button)
838
+ - Your app detects it's a good time to update (e.g., user finished critical task)
839
+ - You want to override a time-based delay early
672
840
 
673
841
  **Since:** 4.0.0
674
842
 
@@ -681,11 +849,26 @@ Cancels a {@link <a href="#delaycondition">DelayCondition</a>} to process an upd
681
849
  getLatest(options?: GetLatestOptions | undefined) => Promise<LatestVersion>
682
850
  ```
683
851
 
684
- Get Latest bundle available from update Url
852
+ Check the update server for the latest available bundle version.
853
+
854
+ This queries your configured update URL (or Capgo backend) to see if a newer bundle
855
+ is available for download. It does NOT download the bundle automatically.
856
+
857
+ The response includes:
858
+ - `version`: The latest available version identifier
859
+ - `url`: Download URL for the bundle (if available)
860
+ - `breaking`: Whether this update is marked as incompatible (requires native app update)
861
+ - `message`: Optional message from the server
862
+ - `manifest`: File list for partial updates (if using multi-file downloads)
863
+
864
+ After receiving the latest version info, you can:
865
+ 1. Compare it with your current version
866
+ 2. Download it using {@link download}
867
+ 3. Apply it using {@link next} or {@link set}
685
868
 
686
- | Param | Type |
687
- | ------------- | ------------------------------------------------------------- |
688
- | **`options`** | <code><a href="#getlatestoptions">GetLatestOptions</a></code> |
869
+ | Param | Type | Description |
870
+ | ------------- | ------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
871
+ | **`options`** | <code><a href="#getlatestoptions">GetLatestOptions</a></code> | Optional {@link <a href="#getlatestoptions">GetLatestOptions</a>} to specify which channel to check. |
689
872
 
690
873
  **Returns:** <code>Promise&lt;<a href="#latestversion">LatestVersion</a>&gt;</code>
691
874
 
@@ -700,15 +883,29 @@ Get Latest bundle available from update Url
700
883
  setChannel(options: SetChannelOptions) => Promise<ChannelRes>
701
884
  ```
702
885
 
703
- Sets the channel for this device. The channel has to allow for self assignment for this to work.
704
- Do not use this method to set the channel at boot.
705
- This method is to set the channel after the app is ready, and user interacted.
706
- If you want to set the channel at boot, use the {@link PluginsConfig} to set the default channel.
707
- This methods send to Capgo backend a request to link the device ID to the channel. Capgo can accept or refuse depending of the setting of your channel.
886
+ Assign this device to a specific update channel at runtime.
708
887
 
709
- | Param | Type | Description |
710
- | ------------- | --------------------------------------------------------------- | -------------------------------------------------------------------------------- |
711
- | **`options`** | <code><a href="#setchanneloptions">SetChannelOptions</a></code> | Is the {@link <a href="#setchanneloptions">SetChannelOptions</a>} channel to set |
888
+ Channels allow you to distribute different bundle versions to different groups of users
889
+ (e.g., "production", "beta", "staging"). This method switches the device to a new channel.
890
+
891
+ **Requirements:**
892
+ - The target channel must allow self-assignment (configured in your Capgo dashboard or backend)
893
+ - The backend may accept or reject the request based on channel settings
894
+
895
+ **When to use:**
896
+ - After the app is ready and the user has interacted (e.g., opted into beta program)
897
+ - To implement in-app channel switching (beta toggle, tester access, etc.)
898
+ - For user-driven channel changes
899
+
900
+ **When NOT to use:**
901
+ - At app boot/initialization - use {@link PluginsConfig.CapacitorUpdater.defaultChannel} config instead
902
+ - Before user interaction
903
+
904
+ This sends a request to the Capgo backend linking your device ID to the specified channel.
905
+
906
+ | Param | Type | Description |
907
+ | ------------- | --------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
908
+ | **`options`** | <code><a href="#setchanneloptions">SetChannelOptions</a></code> | The {@link <a href="#setchanneloptions">SetChannelOptions</a>} containing the channel name and optional auto-update trigger. |
712
909
 
713
910
  **Returns:** <code>Promise&lt;<a href="#channelres">ChannelRes</a>&gt;</code>
714
911
 
@@ -723,7 +920,16 @@ This methods send to Capgo backend a request to link the device ID to the channe
723
920
  unsetChannel(options: UnsetChannelOptions) => Promise<void>
724
921
  ```
725
922
 
726
- Unset the channel for this device. The device will then return to the default channel
923
+ Remove the device's channel assignment and return to the default channel.
924
+
925
+ This unlinks the device from any specifically assigned channel, causing it to fall back to:
926
+ - The {@link PluginsConfig.CapacitorUpdater.defaultChannel} if configured, or
927
+ - Your backend's default channel for this app
928
+
929
+ Use this when:
930
+ - Users opt out of beta/testing programs
931
+ - You want to reset a device to standard update distribution
932
+ - Testing channel switching behavior
727
933
 
728
934
  | Param | Type |
729
935
  | ------------- | ------------------------------------------------------------------- |
@@ -740,7 +946,18 @@ Unset the channel for this device. The device will then return to the default ch
740
946
  getChannel() => Promise<GetChannelRes>
741
947
  ```
742
948
 
743
- Get the channel for this device
949
+ Get the current channel assigned to this device.
950
+
951
+ Returns information about:
952
+ - `channel`: The currently assigned channel name (if any)
953
+ - `allowSet`: Whether the channel allows self-assignment
954
+ - `status`: Operation status
955
+ - `error`/`message`: Additional information (if applicable)
956
+
957
+ Use this to:
958
+ - Display current channel to users (e.g., "You're on the Beta channel")
959
+ - Check if a device is on a specific channel before showing features
960
+ - Verify channel assignment after calling {@link setChannel}
744
961
 
745
962
  **Returns:** <code>Promise&lt;<a href="#getchannelres">GetChannelRes</a>&gt;</code>
746
963
 
@@ -755,7 +972,21 @@ Get the channel for this device
755
972
  listChannels() => Promise<ListChannelsResult>
756
973
  ```
757
974
 
758
- List all channels available for this device that allow self-assignment
975
+ Get a list of all channels available for this device to self-assign to.
976
+
977
+ Only returns channels where `allow_self_set` is `true`. These are channels that
978
+ users can switch to using {@link setChannel} without backend administrator intervention.
979
+
980
+ Each channel includes:
981
+ - `id`: Unique channel identifier
982
+ - `name`: Human-readable channel name
983
+ - `public`: Whether the channel is publicly visible
984
+ - `allow_self_set`: Always `true` in results (filtered to only self-assignable channels)
985
+
986
+ Use this to:
987
+ - Build a channel selector UI for users (e.g., "Join Beta" button)
988
+ - Show available testing/preview channels
989
+ - Implement channel discovery features
759
990
 
760
991
  **Returns:** <code>Promise&lt;<a href="#listchannelsresult">ListChannelsResult</a>&gt;</code>
761
992
 
@@ -770,14 +1001,26 @@ List all channels available for this device that allow self-assignment
770
1001
  setCustomId(options: SetCustomIdOptions) => Promise<void>
771
1002
  ```
772
1003
 
773
- Set a custom ID for this device
1004
+ Set a custom identifier for this device.
1005
+
1006
+ This allows you to identify devices by your own custom ID (user ID, account ID, etc.)
1007
+ instead of or in addition to the device's unique hardware ID. The custom ID is sent
1008
+ to your update server and can be used for:
1009
+ - Targeting specific users for updates
1010
+ - Analytics and user tracking
1011
+ - Debugging and support (correlating devices with users)
1012
+ - A/B testing or feature flagging
774
1013
 
775
- When {@link PluginsConfig.CapacitorUpdater.persistCustomId} is true, the value will be stored natively and restored on the next app launch.
776
- Pass an empty string to remove any previously stored customId.
1014
+ **Persistence:**
1015
+ - When {@link PluginsConfig.CapacitorUpdater.persistCustomId} is `true`, the ID persists across app restarts
1016
+ - When `false`, the ID is only kept for the current session
777
1017
 
778
- | Param | Type | Description |
779
- | ------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------------------------- |
780
- | **`options`** | <code><a href="#setcustomidoptions">SetCustomIdOptions</a></code> | is the {@link <a href="#setcustomidoptions">SetCustomIdOptions</a>} customId to set |
1018
+ **Clearing the custom ID:**
1019
+ - Pass an empty string `""` to remove any stored custom ID
1020
+
1021
+ | Param | Type | Description |
1022
+ | ------------- | ----------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
1023
+ | **`options`** | <code><a href="#setcustomidoptions">SetCustomIdOptions</a></code> | The {@link <a href="#setcustomidoptions">SetCustomIdOptions</a>} containing the custom identifier string. |
781
1024
 
782
1025
  **Since:** 4.9.0
783
1026
 
@@ -790,7 +1033,21 @@ Pass an empty string to remove any previously stored customId.
790
1033
  getBuiltinVersion() => Promise<BuiltinVersion>
791
1034
  ```
792
1035
 
793
- Get the native app version or the builtin version if set in config
1036
+ Get the builtin bundle version (the original version shipped with your native app).
1037
+
1038
+ This returns the version of the bundle that was included when the app was installed
1039
+ from the App Store or Play Store. This is NOT the currently active bundle version -
1040
+ use {@link current} for that.
1041
+
1042
+ Returns:
1043
+ - The {@link PluginsConfig.CapacitorUpdater.version} config value if set, or
1044
+ - The native app version from platform configs (package.json, Info.plist, build.gradle)
1045
+
1046
+ Use this to:
1047
+ - Display the "factory" version to users
1048
+ - Compare against downloaded bundle versions
1049
+ - Determine if any updates have been applied
1050
+ - Debugging version mismatches
794
1051
 
795
1052
  **Returns:** <code>Promise&lt;<a href="#builtinversion">BuiltinVersion</a>&gt;</code>
796
1053
 
@@ -805,16 +1062,28 @@ Get the native app version or the builtin version if set in config
805
1062
  getDeviceId() => Promise<DeviceId>
806
1063
  ```
807
1064
 
808
- Get unique ID used to identify device (sent to auto update server).
1065
+ Get the unique, privacy-friendly identifier for this device.
1066
+
1067
+ This ID is used to identify the device when communicating with update servers.
1068
+ It's automatically generated and stored securely by the plugin.
1069
+
1070
+ **Privacy & Security characteristics:**
1071
+ - Generated as a UUID (not based on hardware identifiers)
1072
+ - Stored securely in platform-specific secure storage
1073
+ - Android: Android Keystore (persists across app reinstalls on API 23+)
1074
+ - iOS: Keychain with `kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly`
1075
+ - Not synced to cloud (iOS)
1076
+ - Follows Apple and Google privacy best practices
1077
+ - Users can clear it via system settings (Android) or keychain access (iOS)
809
1078
 
810
- This ID is privacy-friendly and follows Apple and Google best practices:
811
- - Generated as a UUID and stored securely
812
- - Android: Uses Android Keystore (persists across reinstalls on API 23+)
813
- - iOS: Uses Keychain with kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly (persists across reinstalls)
814
- - Data stays on device (not synced to cloud on iOS)
815
- - Can be cleared by user via system settings (Android) or keychain access (iOS)
1079
+ **Persistence:**
1080
+ The device ID persists across app reinstalls to maintain consistent device identity
1081
+ for update tracking and analytics.
816
1082
 
817
- The device ID now persists between app reinstalls to maintain consistent device identity.
1083
+ Use this to:
1084
+ - Debug update delivery issues (check what ID the server sees)
1085
+ - Implement device-specific features
1086
+ - Correlate server logs with specific devices
818
1087
 
819
1088
  **Returns:** <code>Promise&lt;<a href="#deviceid">DeviceId</a>&gt;</code>
820
1089
 
@@ -827,7 +1096,16 @@ The device ID now persists between app reinstalls to maintain consistent device
827
1096
  getPluginVersion() => Promise<PluginVersion>
828
1097
  ```
829
1098
 
830
- Get the native Capacitor Updater plugin version (sent to auto update server)
1099
+ Get the version of the Capacitor Updater plugin installed in your app.
1100
+
1101
+ This returns the version of the native plugin code (Android/iOS), which is sent
1102
+ to the update server with each request. This is NOT your app version or bundle version.
1103
+
1104
+ Use this to:
1105
+ - Debug plugin-specific issues (when reporting bugs)
1106
+ - Verify plugin installation and version
1107
+ - Check compatibility with backend features
1108
+ - Display in debug/about screens
831
1109
 
832
1110
  **Returns:** <code>Promise&lt;<a href="#pluginversion">PluginVersion</a>&gt;</code>
833
1111
 
@@ -840,7 +1118,18 @@ Get the native Capacitor Updater plugin version (sent to auto update server)
840
1118
  isAutoUpdateEnabled() => Promise<AutoUpdateEnabled>
841
1119
  ```
842
1120
 
843
- Get the state of auto update config.
1121
+ Check if automatic updates are currently enabled.
1122
+
1123
+ Returns `true` if {@link PluginsConfig.CapacitorUpdater.autoUpdate} is enabled,
1124
+ meaning the plugin will automatically check for, download, and apply updates.
1125
+
1126
+ Returns `false` if in manual mode, where you control the update flow using
1127
+ {@link getLatest}, {@link download}, {@link next}, and {@link set}.
1128
+
1129
+ Use this to:
1130
+ - Determine which update flow your app is using
1131
+ - Show/hide manual update UI based on mode
1132
+ - Debug update behavior
844
1133
 
845
1134
  **Returns:** <code>Promise&lt;<a href="#autoupdateenabled">AutoUpdateEnabled</a>&gt;</code>
846
1135
 
@@ -853,7 +1142,21 @@ Get the state of auto update config.
853
1142
  removeAllListeners() => Promise<void>
854
1143
  ```
855
1144
 
856
- Remove all listeners for this plugin.
1145
+ Remove all event listeners registered for this plugin.
1146
+
1147
+ This unregisters all listeners added via {@link addListener} for all event types:
1148
+ - `download`
1149
+ - `noNeedUpdate`
1150
+ - `updateAvailable`
1151
+ - `downloadComplete`
1152
+ - `downloadFailed`
1153
+ - `breakingAvailable` / `majorAvailable`
1154
+ - `updateFailed`
1155
+ - `appReloaded`
1156
+ - `appReady`
1157
+
1158
+ Use this during cleanup (e.g., when unmounting components or closing screens)
1159
+ to prevent memory leaks from lingering event listeners.
857
1160
 
858
1161
  **Since:** 1.0.0
859
1162
 
@@ -1068,7 +1371,16 @@ Listen for app ready event in the App, let you know when app is ready to use, th
1068
1371
  isAutoUpdateAvailable() => Promise<AutoUpdateAvailable>
1069
1372
  ```
1070
1373
 
1071
- Get if auto update is available (not disabled by serverUrl).
1374
+ Check if the auto-update feature is available (not disabled by custom server configuration).
1375
+
1376
+ Returns `false` when a custom `updateUrl` is configured, as this typically indicates
1377
+ you're using a self-hosted update server that may not support all auto-update features.
1378
+
1379
+ Returns `true` when using the default Capgo backend or when the feature is available.
1380
+
1381
+ This is different from {@link isAutoUpdateEnabled}:
1382
+ - `isAutoUpdateEnabled()`: Checks if auto-update MODE is turned on/off
1383
+ - `isAutoUpdateAvailable()`: Checks if auto-update is SUPPORTED with your current configuration
1072
1384
 
1073
1385
  **Returns:** <code>Promise&lt;<a href="#autoupdateavailable">AutoUpdateAvailable</a>&gt;</code>
1074
1386
 
@@ -1081,8 +1393,23 @@ Get if auto update is available (not disabled by serverUrl).
1081
1393
  getNextBundle() => Promise<BundleInfo | null>
1082
1394
  ```
1083
1395
 
1084
- Get the next bundle that will be used when the app reloads.
1085
- Returns null if no next bundle is set.
1396
+ Get information about the bundle queued to be activated on next reload.
1397
+
1398
+ Returns:
1399
+ - {@link <a href="#bundleinfo">BundleInfo</a>} object if a bundle has been queued via {@link next}
1400
+ - `null` if no update is pending
1401
+
1402
+ This is useful to:
1403
+ - Check if an update is waiting to be applied
1404
+ - Display "Update pending" status to users
1405
+ - Show version info of the queued update
1406
+ - Decide whether to show a "Restart to update" prompt
1407
+
1408
+ The queued bundle will be activated when:
1409
+ - The app is backgrounded (default behavior)
1410
+ - The app is killed and restarted
1411
+ - {@link reload} is called manually
1412
+ - Delay conditions set by {@link setMultiDelay} are met
1086
1413
 
1087
1414
  **Returns:** <code>Promise&lt;<a href="#bundleinfo">BundleInfo</a> | null&gt;</code>
1088
1415
 
@@ -1097,7 +1424,25 @@ Returns null if no next bundle is set.
1097
1424
  getFailedUpdate() => Promise<UpdateFailedEvent | null>
1098
1425
  ```
1099
1426
 
1100
- Get the most recent update that failed to install, if any. The stored value is cleared after it is retrieved once.
1427
+ Retrieve information about the most recent bundle that failed to load.
1428
+
1429
+ When a bundle fails to load (e.g., JavaScript errors prevent initialization, missing files),
1430
+ the plugin automatically rolls back and stores information about the failure. This method
1431
+ retrieves that failure information.
1432
+
1433
+ **IMPORTANT: The stored value is cleared after being retrieved once.**
1434
+ Calling this method multiple times will only return the failure info on the first call,
1435
+ then `null` on subsequent calls until another failure occurs.
1436
+
1437
+ Returns:
1438
+ - {@link <a href="#updatefailedevent">UpdateFailedEvent</a>} with bundle info if a failure was recorded
1439
+ - `null` if no failure has occurred or if it was already retrieved
1440
+
1441
+ Use this to:
1442
+ - Show users why an update failed
1443
+ - Log failure information for debugging
1444
+ - Implement custom error handling/reporting
1445
+ - Display rollback notifications
1101
1446
 
1102
1447
  **Returns:** <code>Promise&lt;<a href="#updatefailedevent">UpdateFailedEvent</a> | null&gt;</code>
1103
1448
 
@@ -1112,11 +1457,27 @@ Get the most recent update that failed to install, if any. The stored value is c
1112
1457
  setShakeMenu(options: SetShakeMenuOptions) => Promise<void>
1113
1458
  ```
1114
1459
 
1115
- Enable or disable the shake menu for debugging/testing purposes
1460
+ Enable or disable the shake gesture menu for debugging and testing.
1461
+
1462
+ When enabled, users can shake their device to open a debug menu that shows:
1463
+ - Current bundle information
1464
+ - Available bundles
1465
+ - Options to switch bundles manually
1466
+ - Update status
1116
1467
 
1117
- | Param | Type | Description |
1118
- | ------------- | ------------------------------------------------------------------- | -------------------------------------------------------- |
1119
- | **`options`** | <code><a href="#setshakemenuoptions">SetShakeMenuOptions</a></code> | Contains enabled boolean to enable or disable shake menu |
1468
+ This is useful during development and testing to:
1469
+ - Quickly test different bundle versions
1470
+ - Debug update flows
1471
+ - Switch between production and test bundles
1472
+ - Verify bundle installations
1473
+
1474
+ **Important:** Disable this in production builds or only enable for internal testers.
1475
+
1476
+ Can also be configured via {@link PluginsConfig.CapacitorUpdater.shakeMenu}.
1477
+
1478
+ | Param | Type |
1479
+ | ------------- | ------------------------------------------------------------------- |
1480
+ | **`options`** | <code><a href="#setshakemenuoptions">SetShakeMenuOptions</a></code> |
1120
1481
 
1121
1482
  **Since:** 7.5.0
1122
1483
 
@@ -1129,7 +1490,15 @@ Enable or disable the shake menu for debugging/testing purposes
1129
1490
  isShakeMenuEnabled() => Promise<ShakeMenuEnabled>
1130
1491
  ```
1131
1492
 
1132
- Get the current state of the shake menu
1493
+ Check if the shake gesture debug menu is currently enabled.
1494
+
1495
+ Returns the current state of the shake menu feature that can be toggled via
1496
+ {@link setShakeMenu} or configured via {@link PluginsConfig.CapacitorUpdater.shakeMenu}.
1497
+
1498
+ Use this to:
1499
+ - Check if debug features are enabled
1500
+ - Show/hide debug settings UI
1501
+ - Verify configuration during testing
1133
1502
 
1134
1503
  **Returns:** <code>Promise&lt;<a href="#shakemenuenabled">ShakeMenuEnabled</a>&gt;</code>
1135
1504
 
@@ -1144,7 +1513,18 @@ Get the current state of the shake menu
1144
1513
  getAppId() => Promise<GetAppIdRes>
1145
1514
  ```
1146
1515
 
1147
- Get the configured App ID
1516
+ Get the currently configured App ID used for update server communication.
1517
+
1518
+ Returns the App ID that identifies this app to the update server. This can be:
1519
+ - The value set via {@link setAppId}, or
1520
+ - The {@link PluginsConfig.CapacitorUpdater.appId} config value, or
1521
+ - The default app identifier from your native app configuration
1522
+
1523
+ Use this to:
1524
+ - Verify which App ID is being used for updates
1525
+ - Debug update delivery issues
1526
+ - Display app configuration in debug screens
1527
+ - Confirm App ID after calling {@link setAppId}
1148
1528
 
1149
1529
  **Returns:** <code>Promise&lt;<a href="#getappidres">GetAppIdRes</a>&gt;</code>
1150
1530
 
@@ -1159,11 +1539,24 @@ Get the configured App ID
1159
1539
  setAppId(options: SetAppIdOptions) => Promise<void>
1160
1540
  ```
1161
1541
 
1162
- Set the App ID for the app (requires allowModifyAppId to be true in config)
1542
+ Dynamically change the App ID used for update server communication.
1543
+
1544
+ This overrides the App ID used to identify your app to the update server, allowing you
1545
+ to switch between different app configurations at runtime (e.g., production vs staging
1546
+ app IDs, or multi-tenant configurations).
1547
+
1548
+ **Requirements:**
1549
+ - {@link PluginsConfig.CapacitorUpdater.allowModifyAppId} must be set to `true`
1550
+
1551
+ **Important considerations:**
1552
+ - Changing the App ID will affect which updates this device receives
1553
+ - The new App ID must exist on your update server
1554
+ - This is primarily for advanced use cases (multi-tenancy, environment switching)
1555
+ - Most apps should use the config-based {@link PluginsConfig.CapacitorUpdater.appId} instead
1163
1556
 
1164
- | Param | Type | Description |
1165
- | ------------- | ----------------------------------------------------------- | --------------------- |
1166
- | **`options`** | <code><a href="#setappidoptions">SetAppIdOptions</a></code> | The new App ID to set |
1557
+ | Param | Type |
1558
+ | ------------- | ----------------------------------------------------------- |
1559
+ | **`options`** | <code><a href="#setappidoptions">SetAppIdOptions</a></code> |
1167
1560
 
1168
1561
  **Since:** 7.14.0
1169
1562