Capacitor Live Update Plugin 7.3.0 Release¶
We are excited to announce version 7.3.0 of the Capacitor Live Update plugin! This release introduces two powerful features that make managing over-the-air (OTA) updates even easier: automatic update strategies and rollback protection. These enhancements reduce the amount of code you need to write while providing a more robust update experience for your users.
Automatic Update Strategies¶
One of the most requested features has been the ability to handle updates automatically without writing boilerplate code in every app. Version 7.3.0 introduces the autoUpdateStrategy configuration option, which automatically manages the entire update lifecycle for you.
By setting autoUpdateStrategy to background in your Capacitor configuration file, the plugin will automatically check for updates at app startup and when the app resumes (with a minimum 15-minute interval between checks), download them in the background, and apply them on the next app launch:
import { CapacitorConfig } from '@capacitor/cli';
const config: CapacitorConfig = {
plugins: {
LiveUpdate: {
appId: "00000000-0000-0000-0000-000000000000",
autoUpdateStrategy: 'background',
defaultChannel: 'production-5'
}
}
};
export default config;
This is equivalent to manually calling the sync() method at app startup and resume, but without requiring any code. It provides the perfect balance between keeping your app up-to-date and preserving device resources like battery and bandwidth.
You can optionally specify a defaultChannel to control which channel to pull updates from, making it easy to implement versioned channels for different app versions.
For apps that need to prompt users to apply updates immediately, you can combine the background strategy with the nextBundleSet event listener:
import { LiveUpdate } from "@capawesome/capacitor-live-update";
const initializeApp = async () => {
LiveUpdate.addListener('nextBundleSet', async () => {
const shouldReload = confirm('A new update is available. Would you like to install it now?');
if (shouldReload) {
await LiveUpdate.reload();
}
});
};
The nextBundleSet event fires whenever a new bundle is set as the next bundle, allowing you to provide users with the option to apply updates without restarting the app.
Automatic Rollback Protection¶
While the plugin has always supported automatic rollbacks for invalid bundles, version 7.3.0 introduces autoBlockRolledBackBundles to prevent rollback loops. While this was already possible using a custom implementation, it is now fully automated. When enabled, this option automatically blocks bundles that caused a rollback and skips them in future sync operations.
This is particularly useful when you accidentally deploy a broken bundle—instead of users getting stuck in a loop where the broken bundle is repeatedly downloaded and rolled back, the plugin will automatically block it and move on to the next available bundle:
import { CapacitorConfig } from '@capacitor/cli';
const config: CapacitorConfig = {
plugins: {
LiveUpdate: {
appId: "00000000-0000-0000-0000-000000000000",
autoUpdateStrategy: 'background',
readyTimeout: 10000,
autoBlockRolledBackBundles: true
}
}
};
export default config;
The readyTimeout option specifies the maximum time (in milliseconds) to wait for your app to signal it's ready before rolling back to the built-in bundle. Make sure to call the ready() method early in your app's lifecycle to prevent automatic rollbacks:
import { LiveUpdate } from "@capawesome/capacitor-live-update";
const initializeApp = async () => {
await LiveUpdate.ready();
};
Together, these options provide a robust safety net that protects your users from problematic updates while keeping your app running smoothly.
Getting Started¶
To take advantage of these new features, update to version 7.3.0:
For more information on implementing different update strategies, check out our Update Strategies guide and Best Practices documentation.
We hope these new features make it even easier to deliver seamless updates to your Capacitor apps. If you have any questions or feedback, please create a discussion in our GitHub repository. Feel free to subscribe to our newsletter to stay updated on the latest releases and features!