article illustration How to Use Capgo Documentation for OTA Updates
Development, Mobile, Updates
Last update: March 18, 2025

How to Use Capgo Documentation for OTA Updates

Learn how to implement secure Over-the-Air updates in your Capacitor apps with Capgo's comprehensive documentation and step-by-step guidance.

Need faster app updates without app store delays? Capgo lets you deliver secure Over-the-Air (OTA) updates instantly to your users. Skip app store reviews and keep your app up-to-date with ease.

Key Takeaways:

  • What is Capgo? An open-source platform for live updates in Capacitor apps.
  • Why OTA Updates? Save time, improve user experience, and fix bugs quickly.
  • How to Get Started?
    • Install the Capgo plugin: npm install @capgo/capacitor-updater
    • Configure your app with an API key.
    • Use channels like “production” or “beta” for targeted rollouts.
  • Advanced Features: End-to-end encryption, error handling, and CI/CD integration.

Capgo’s documentation (capgo.app/docs) provides step-by-step instructions for setup, security, and troubleshooting. From installation to advanced configurations, it’s your go-to guide for seamless updates.

Capgo, CapacitorJs plugin for Live update

Capgo

Using Capgo Documentation

Navigating documentation effectively is essential when working with OTA updates. Capgo’s documentation offers detailed guidance for integrating live updates into Capacitor apps.

Where to Find the Documentation

You can access Capgo’s documentation at capgo.app/docs [1]. It’s organized into sections based on specific purposes:

SectionPurposeKey Topics
Getting StartedInitial setupInstallation steps, API key setup
ConfigurationCore settingsPlugin configuration, environment setup
API ReferenceTechnical detailsMethods, parameters, return values
SecurityProtection measuresEncryption setup, signature verification
TroubleshootingProblem-solvingCommon issues, diagnostic tools

Instant Updates for CapacitorJS Apps

Push updates, fixes, and features instantly to your CapacitorJS apps without app store delays. Experience seamless integration, end-to-end encryption, and real-time updates with Capgo.

Get Started Now

Important Terms and Concepts

Here are some key terms you’ll encounter:

  • Channels: These are update streams used to control version distribution. For instance, you might set up “production”, “beta”, and “staging” channels to cater to different user groups [4].
  • Update Policies: These define how updates are delivered and applied. Options include automatic downloads, installation timing, and user prompts [1].
  • App State Listeners: These components track whether the app is in the foreground or background [4].
  • Bundles: Packaged update files containing your app’s new version, including assets, code changes, and configuration updates [4].

Code Examples and Tutorials

The documentation provides sample code to simplify integration. Here’s a basic example using TypeScript/JavaScript:

import { CapacitorUpdater } from '@capgo/capacitor-updater'
// Initialize the updater
await CapacitorUpdater.notifyAppReady()

For more advanced use cases, the documentation includes real-world examples [2][3], such as:

  • Switching channels for A/B testing
  • Custom update flows with user prompts
  • Handling errors and implementing rollbacks
  • Integrating updates with CI/CD pipelines

Each tutorial also highlights performance considerations and security aspects, helping you make informed decisions. The documentation is frequently updated to include the latest features and best practices [1].

For implementation details, check out the setup guide next.

Setting Up OTA Updates

Set up OTA updates in Capgo to streamline your deployment process. Follow these steps and tips for a hassle-free configuration.

Basic Setup Steps

Start by installing the Capgo plugin in your Capacitor project:

npm install @capgo/capacitor-updater
npx cap sync

Next, update your capacitor.config.json file with your Capgo API key:

{
"plugins": {
"CapacitorUpdater": {
"autoUpdate": true,
"apiKey": "YOUR_API_KEY_HERE"
}
}
}

Then, initialize the updater in your app’s main file to detect updates:

import { CapacitorUpdater } from '@capgo/capacitor-updater';
await CapacitorUpdater.notifyAppReady();

Once this is done, you can set up channels to manage different update streams.

Update Channel Setup

Organize your update channels to suit your deployment needs:

Channel TypePurposeUse Case
ProductionStable releasesGeneral user base
StagingPre-release testingQA team and beta testers
BetaFeature testingEarly adopters

To upload an update to a specific channel, use the Capgo CLI:

Terminal window
npx @capgo/cli upload -c production

Update Methods

Capgo provides two main ways to handle updates:

Automatic Updates
Enable automatic updates by setting autoUpdate: true in your configuration. This ensures updates are applied in the background with no extra effort from developers.

Manual Updates
For more control, you can manage updates manually. Use the following pattern to check for and apply updates:

// Check for updates
const update = await CapacitorUpdater.download();
// Install when ready
if (update) {
await CapacitorUpdater.set(update);
}

For critical updates, you can prompt users before proceeding:

if (update.version > currentVersion) {
const userConsent = await showUpdatePrompt();
if (userConsent) {
await CapacitorUpdater.set(update);
}
}

You can also target specific user groups with custom IDs and channels:

await CapacitorUpdater.setCustomId('beta-tester-123');
await CapacitorUpdater.setChannel('beta');

Finally, make sure to include error handling and rollback options:

try {
await CapacitorUpdater.set(update);
} catch (error) {
await CapacitorUpdater.reset(); // Revert to the last working version
console.error('Update failed:', error);
}

With these steps, your OTA update system is ready to go. Explore advanced settings to customize the update process further.

sbb-itb-f9944d2

Advanced Settings

Improve your Capgo OTA update setup with added security measures and flexible update configurations. These options ensure a secure and smooth update experience while meeting app store guidelines.

Security Features

Capgo provides strong security protocols to safeguard your update bundles and deliver them securely to users. The platform uses end-to-end encryption with public-key cryptography for all updates [1]. Below is how you can enable key security features:

// Enable bundle verification
await CapacitorUpdater.setVerifyBundles(true);
// Configure encryption settings
await CapacitorUpdater.configure({
encryption: {
enabled: true,
failOnError: true
}
});

Key components of the bundle protection system include:

Security FeatureDescriptionImplementation
Bundle IntegrityVerifies package authenticity with cryptographic signaturesAutomatically enabled with setVerifyBundles()
Rollback ProtectionReverts to a stable version if an update failsBuilt into the update process
Access ControlManages updates with role-based permissionsConfigured via the dashboard

Update Behavior Settings

You can customize how updates are delivered and installed by using event listeners and configuration options. Adjust the timing and user interaction for updates with these settings:

// Listen for when an update is available
CapacitorUpdater.addListener('updateAvailable', async (info) => {
if (info.version > currentVersion) {
// Custom update logic based on app state
const isAppInactive = await checkAppState();
if (isAppInactive) {
await CapacitorUpdater.download();
}
}
});
// Monitor download completion
CapacitorUpdater.addListener('downloadComplete', (info) => {
console.log(`Update ${info.version} ready to install`);
// Implement custom installation timing if desired
});

For phased rollouts, you can configure update distribution directly through the dashboard or with code:

// Set custom update conditions for a gradual rollout
await CapacitorUpdater.configure({
rollout: {
percentage: 25, // Start with 25% of users
timeInterval: 24 // Increase rollout percentage every 24 hours
}
});

To handle specific version-related behaviors:

// Handle version-specific update failures
CapacitorUpdater.addListener('updateFailed', async (info) => {
if (info.error.code === 'VERSION_MISMATCH') {
await CapacitorUpdater.reset(); // Revert to the last stable version
// Optionally, handle error notification here
}
});

These settings ensure updates are reliable while allowing you to tailor the process to your app’s needs. Always test updates thoroughly in Capgo’s staging environment before rolling them out to production [2].

Problem Solving Guide

Capgo’s error logs and built-in tools help tackle OTA update challenges while keeping your app compliant with store requirements.

Common Issues and Solutions

Here are some typical problems and how to address them:

  • Failed Downloads
    Symptoms: Downloads freeze or fail to complete.
    Solution: Check your network connection, confirm the update URL is valid, and add retry mechanisms to handle interruptions.

  • Version Conflicts
    Symptoms: Updates either fail to install or cause app instability.
    Solution: Use clear version numbers to avoid conflicts and implement rollback options for safety.

  • Installation Errors
    Symptoms: Updates fail or trigger automatic rollbacks.
    Solution: Ensure you call notifyAppReady() after a successful update to prevent rollbacks.

For updates larger than 50MB, splitting them into smaller files can improve performance on Android devices [5].

Use detailed error logging to catch problems early. For example, implement this listener:

CapacitorUpdater.addListener('updateFailed', (error) => {
console.log(`Update failed: ${error.code}`);
logUpdateError({
errorCode: error.code,
deviceInfo: error.device,
timestamp: new Date().toISOString()
});
});

By combining error logging with pre-checks, you can handle these issues effectively before focusing on compliance.

App Store Rules

Technical fixes alone aren’t enough - your updates also need to align with app store guidelines.

Apple App Store Requirements:

  • User Transparency: Clearly inform users about the update’s content and get their consent.
  • Core Functionality: Ensure your app’s main features remain intact as reviewed.
  • Security Measures: Use secure methods for transmitting updates.

Android Implementation:

await CapacitorUpdater.configure({
updateNotification: {
title: "Update Available",
message: "A new version is available. Please update to access the latest features.",
requireUserConsent: true
}
});

Best Practices:

  • Version Control: Roll out updates gradually to reduce conflicts.
  • Update Notifications: Provide clear and user-friendly update alerts.
  • Security: Verify the bundle’s integrity and use encryption to protect data.

Summary

This section pulls together the main ideas from the guide.

Capgo’s documentation provides clear instructions for integrating OTA updates into Capacitor apps while staying compliant with app store regulations.

Using Capgo’s resources, developers can implement essential features like end-to-end encryption and CI/CD integration, covering everything from initial setup to advanced configurations [1].

Key Implementation Areas

AspectKey FocusWhere to Find It
SecurityEncryption and integrity checksSecurity Features section
ComplianceMeeting Apple and Android requirementsApp Store Rules guide
Update ManagementVersion control and rollback optionsUpdate Methods guide
Error HandlingLogging and troubleshooting stepsProblem Solving Guide

These areas form the backbone of Capgo’s update management system.

Capgo’s CLI and analytics tools simplify managing updates throughout your app’s lifecycle [1].

For further support, you can explore additional resources like API documentation, sample projects, and community forums [2].

Authored By

Instant Updates for CapacitorJS Apps

Push updates, fixes, and features instantly to your CapacitorJS apps without app store delays. Experience seamless integration, end-to-end encryption, and real-time updates with Capgo.

Get Started Now

Latest from news

Capgo gives you the best insights you need to create a truly professional mobile app.

blog illustration 5 Security Best Practices for Mobile App Live Updates
Development, Mobile, Updates
January 14, 2025

5 Security Best Practices for Mobile App Live Updates

Read more
blog illustration 5 Steps to Deploy Hotfixes with Capgo
Development, Mobile, Updates
March 13, 2025

5 Steps to Deploy Hotfixes with Capgo

Read more