The @capgo/capacitor-updater package provides native updater functionality for your Capacitor mobile applications on iOS and Android. This comprehensive tutorial will guide you through integrating updater features into your iOS and Android mobile apps built with Capacitor or Cordova, enabling cross-platform mobile app development with native capabilities.
Capacitor is Ionic's modern native runtime that enables developers to build native iOS apps, Android apps, and Progressive Web Apps from a single codebase. Unlike older Cordova-based mobile development, Capacitor provides direct access to native iOS and Android APIs, making it the ideal choice for building production-ready mobile applications. This Capacitor plugin brings updater capabilities to both iOS and Android mobile platforms.
The @capgo/capacitor-updater plugin enables your iOS and Android mobile applications to leverage native updater functionality without writing platform-specific code. This Capacitor plugin provides a unified JavaScript API that works seamlessly on both iOS and Android mobile devices, making it perfect for cross-platform mobile app development.
Benefits for iOS and Android mobile applications:
This tutorial will guide you through the process of using the @capgo/capacitor-updater package to enable auto-updates in your Ionic Capacitor app.
Before we start, make sure you have the following installed:
To install the @capgo/capacitor-updater package, open your terminal or command prompt and run the following command:
npm install @capgo/capacitor-updater
This will download and install the package in your project.
You should end up with this code added to your app :
npm i @capgo/capacitor-updater && npx cap sync
To install the plugin into your Capacitor app.
And then add to your app this code to notify the native plugin that the JS bundle is healthy, the native plugin will rollback to the previous version, if you fail to do so :
import { CapacitorUpdater } from '@capgo/capacitor-updater'
CapacitorUpdater.notifyAppReady()
This will tell the native plugin the installation as succeeded.
Then do a npm run build && npx cap copy to update your app.
First, use the all apikey present in your account to log in with the CLI:
npx @capgo/cli@latest login YOU_KEY
Let's get started by first creating an app in Capgo Cloud with the CLI.
npx @capgo/cli@latest app add
This command will use all variables defined in the Capacitor config file to create the app.
Run the command to build your code and send it to Capgo with:
npx @capgo/cli@latest bundle upload
By default, the version name will be the one in your package.json file.
Check in Capgo if the build is present.
You can even test it with my mobile sandbox app.
After you have sent your app to Capgo, you need to make your channel default to let apps receive updates from Capgo.
npx @capgo/cli@latest channel set production -s default
For your application to receive a live update from Deploy, you'll need to run the app on a device or an emulator. The easiest way to do this is simply to use the following command to launch your local app in an emulator or a device connected to your computer.
npx cap run [ios | android]
Open the app, put it in the background and open it again, you should see in the logs the app did the update.
Congrats! 🎉 You have successfully deployed your first Live Update. This is just the start of what you can do with Live Updates. To learn more, view the complete Live Updates docs.
If you need to stop receive in local the update run this command
npx @capgo/cli@latest channel set
Congratulations! You have successfully learned how to use the @capgo/capacitor-updater package to enable auto-updates in your Ionic Capacitor app. Whether you choose the auto-update or manual setup, you now have the tools to keep your app up-to-date with ease.
While this updater plugin works with both Capacitor and Cordova mobile frameworks, Capacitor offers significant advantages for iOS and Android mobile app development:
You have successfully integrated @capgo/capacitor-updater into your Capacitor mobile application for iOS and Android. This plugin provides native updater capabilities for both iOS and Android mobile platforms, enabling professional mobile app development with a unified codebase.
For detailed API documentation and advanced updater features for mobile app development, visit the GitHub repository.
Whether you're building native iOS apps, Android mobile applications, or cross-platform Capacitor mobile apps, this updater plugin provides the native capabilities you need for professional mobile app development on iOS and Android platforms.