콘텐츠로 건너뛰기

Using Capgo in China

이 콘텐츠는 아직 귀하의 언어로 제공되지 않습니다.

If you’re deploying your app to users in China, you’ll need to configure Capgo to use regional OST (Object Storage Technology) URLs to ensure reliable and fast updates.

Why Use China-Specific URLs?

Due to network infrastructure and regulations in China (the Great Firewall), direct connections to international servers can be slow or unreliable. Capgo provides dedicated OST URLs with data located in Hong Kong to minimize latency and ensure your users receive updates as quickly and reliably as possible.

Configuration

To configure Capgo for China, you need to set three specific URLs in your Capacitor configuration file. These URLs point to Capgo’s Hong Kong-based infrastructure.

  1. Open your capacitor.config.ts file

  2. Add the following configuration to the CapacitorUpdater plugin section:

    import { CapacitorConfig } from '@capacitor/cli';
    const config: CapacitorConfig = {
    plugins: {
    CapacitorUpdater: {
    autoUpdate: true,
    updateUrl: 'https://updater.capgo.com.cn/updates',
    statsUrl: 'https://updater.capgo.com.cn/stats',
    channelUrl: 'https://updater.capgo.com.cn/channel_self',
    },
    },
    };
    export default config;
  3. Rebuild your app to apply the changes:

    Terminal window
    npm run build
    npx cap sync

Configuration Details

Here’s what each URL does:

  • updateUrl: https://updater.capgo.com.cn/updates - Used to check for and download available updates for your app
  • statsUrl: https://updater.capgo.com.cn/stats - Used to report analytics and usage statistics back to Capgo
  • channelUrl: https://updater.capgo.com.cn/channel_self - Used to retrieve channel configuration and determine which updates to apply

Due to network performance limitations caused by the Great Firewall of China, we have specific recommendations for apps deployed in mainland China:

Disable Direct Updates

We strongly recommend disabling directUpdate for apps in China. Network connectivity in China is less performant than in other regions, and direct updates (which apply immediately) can lead to a poor user experience if downloads are interrupted or slow.

Instead, use the default update behavior where updates download in the background and apply when the app backgrounds or restarts. This provides a more reliable experience for your users.

const config: CapacitorConfig = {
plugins: {
CapacitorUpdater: {
autoUpdate: true,
directUpdate: false, // Recommended for China
updateUrl: 'https://updater.capgo.com.cn/updates',
statsUrl: 'https://updater.capgo.com.cn/stats',
channelUrl: 'https://updater.capgo.com.cn/channel_self',
},
},
};

Complete Configuration Example

Here’s a complete example with recommended settings for apps deployed in China:

import { CapacitorConfig } from '@capacitor/cli';
const config: CapacitorConfig = {
appId: 'com.example.app',
appName: 'My App',
webDir: 'dist',
plugins: {
CapacitorUpdater: {
autoUpdate: true,
directUpdate: false, // Recommended: disable for better reliability in China
updateUrl: 'https://updater.capgo.com.cn/updates',
statsUrl: 'https://updater.capgo.com.cn/stats',
channelUrl: 'https://updater.capgo.com.cn/channel_self',
},
},
};
export default config;

Testing Your Configuration

After configuring the China-specific URLs, you can verify that updates are working correctly:

  1. Upload a new bundle to Capgo:

    Terminal window
    npx @capgo/cli@latest bundle upload --channel=Production
  2. Install your app on a test device in China

  3. Monitor the update process:

    Terminal window
    npx @capgo/cli@latest app debug
  4. Check that updates are being downloaded from the China OST URLs

Multi-Region Deployment

If your app serves users both inside and outside China, you may want to consider:

  • Building separate app variants with different configurations
  • Using environment-based configuration to dynamically set the URLs
  • Creating different release channels for different regions

If you need assistance with multi-region deployment strategies, please contact us at support@capgo.app or join our Discord community for help.

Troubleshooting

If you experience issues with updates in China:

  1. Verify your configuration - Double-check that all three URLs are correctly set in your capacitor.config.ts
  2. Check network connectivity - Ensure your device can reach the updater.capgo.com.cn domain
  3. Review logs - Use npx @capgo/cli@latest app debug to check for error messages
  4. Test updates - Try uploading a new bundle and monitoring the download process
  5. Contact support - If issues persist, reach out to us at support@capgo.app or join our Discord community for assistance

Next Steps