Using Capgo in China
Dieser Inhalt ist in Ihrer Sprache noch nicht verfügbar.
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.
-
Open your
capacitor.config.tsfile -
Add the following configuration to the
CapacitorUpdaterplugin 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; -
Rebuild your app to apply the changes:
Terminal window npm run buildnpx 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
Recommended Settings for China
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:
-
Upload a new bundle to Capgo:
Terminal window npx @capgo/cli@latest bundle upload --channel=Production -
Install your app on a test device in China
-
Monitor the update process:
Terminal window npx @capgo/cli@latest app debug -
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:
- Verify your configuration - Double-check that all three URLs are correctly set in your
capacitor.config.ts - Check network connectivity - Ensure your device can reach the
updater.capgo.com.cndomain - Review logs - Use
npx @capgo/cli@latest app debugto check for error messages - Test updates - Try uploading a new bundle and monitoring the download process
- Contact support - If issues persist, reach out to us at support@capgo.app or join our Discord community for assistance
Next Steps
- Learn about Update Behavior to customize when updates are applied
- Explore Channels to manage different release tracks
- Review Encryption to secure your updates