Skip to content

Getting Started

In this guide, you will learn how to set up Capawesome Cloud Live Updates in your Capacitor app.

Preparation

First, create an account on the Capawesome Cloud Console to manage your live updates.

Register

Installation

Within your Capacitor app project, install the Capacitor Live Update plugin:

npm install @capawesome/capacitor-live-update

Sync your Capacitor project to register the plugin:

npx cap sync

Configuration

Next, you need to configure the plugin to work with Capawesome Cloud.

App ID

In order for your app to identify itself to Capawesome Cloud, you must configure an app ID. For this, you need to create an app on the Capawesome Cloud Console. The app ID can then be copied via the item menu:

Copy App ID

Paste the app ID into the Capacitor configuration file of your project:

capacitor.config.json
{
  "plugins": {
    "LiveUpdate": {
      "appId": "00000000-0000-0000-0000-000000000000"
    }
  }
}

After configuring the app ID, sync your Capacitor project to apply the changes:

npx cap sync

That's it! Your app is now ready to receive live updates from Capawesome Cloud.

Usage

The following two methods are essential for using the plugin:

  1. ready(): Notify the plugin that the app is ready to use and no rollback (1) is needed. This method should be called as soon as possible after the app starts.
  2. sync(): Automatically download and set the latest bundle for the app.
  1. The plugin automatically resets the app to the default bundle if the new bundle is not working as expected. This is called a rollback. Calling the ready() method tells the plugin that the app is working as expected and no rollback is needed.

The reload() method is optional and is only needed if you want to apply the new bundle immediately.

import { LiveUpdate } from '@capawesome/capacitor-live-update';

/**
 * Call this method directly after the app starts
 * to notify the plugin that the app is ready to use
 * and no rollback is needed.
 */
const ready = async () => {
    await LiveUpdate.ready();
};

/**
 * Call this method to download and set the latest bundle for the app.
 */
const sync = async () => {
    const result = await LiveUpdate.sync();
    if (result.nextBundleId) {
        await LiveUpdate.reload();
    }
};

Check out the API reference to see what else you can do with this plugin.

Finally, you need to deploy your first live update to Capawesome Cloud by creating a bundle.