내용으로 건너뛰기

Cordova 업데이터와 함께 시작하기

GitHub

이 가이드는 iOS 및 Android에서 __CAPGO_KEEP_0__ 라이브 업데이트를 받기 위해 Cordova 앱에 추가하는 방법을 안내합니다. @capgo/cordova-updater to a Cordova app so you can receive Capgo live updates on iOS and Android.

필요 조건

필요 조건
  • Cordova CLI 12+
  • Cordova Android 13 이상과/또는 Cordova iOS 7 이상
  • A Capgo account (capgo.app/register)

설치

설치
  1. Install the plugin from npm and pass your Capgo app ID:

    터미널 창
    cordova plugin add @capgo/cordova-updater --variable APP_ID=YOUR_CAPGO_APP_ID
  2. 설치 시 기본값을 오버라이드할 수 있습니다 (업데이터 Capacitor와 동일한 변수):

    터미널 창
    cordova plugin add @capgo/cordova-updater \
    --variable APP_ID=YOUR_CAPGO_APP_ID \
    --variable DEFAULT_CHANNEL=production \
    --variable UPDATE_URL=https://plugin.capgo.app/updates \
    --variable AUTO_UPDATE=atBackground
  3. 플러그인 변수가 변경된 후 네이티브 프로젝트를 준비하세요:

    터미널 창
    cordova prepare android ios

자바스크립트 사용

자바스크립트 사용

변경 후 플러그인은 deviceready__CAPGO_KEEP_0__와 동일한 변수로 사용할 수 있습니다. cordova.plugins.Updater:

document.addEventListener('deviceready', async () => {
const { Updater } = cordova.plugins;
await Updater.notifyAppReady();
const latest = await Updater.getLatest();
if (latest.url && !latest.error) {
const bundle = await Updater.download({
url: latest.url,
version: latest.version,
checksum: latest.checksum,
});
await Updater.next({ id: bundle.id });
}
});

npm 패키지에 TypeScript 타입이 포함되어 있습니다.

import type { UpdaterPlugin } from '@capgo/cordova-updater';
declare const cordova: { plugins: { Updater: UpdaterPlugin } };

플랫폼 참고 사항

플랫폼 참고 사항
  • Cordova Android 13 이상이 필요하여 WebView는 기본 https://localhost/ scheme에서 제공됩니다.
  • 이 플러그인은 다운로드 된 패키지 자산을 CordovaPluginPathHandler 을 제공하기 위해

첫 번째 배치를 업로드하세요

제목: 첫 번째 배치를 업로드하세요

웹 자산을 빌드한 후 Capgo CLI (Capacitor와 동일한 워크플로우)와 함께 업로드하세요:

터미널 창
bun run build
bunx @capgo/cli@latest bundle upload --channel=production
  • 업데이터 __CAPGO_KEEP_0__ 설정과 비교하세요 업데이터 Capacitor 설정과 비교하세요 — 대부분의 옵션은 변수에 mapping됩니다. plugin.xml 변수.
  • 읽기 실시간 업데이트 호환성 native 플러그인 변경 사항을 배송하기 전에.
  • Capacitor로 마이그레이션하는지 궁금하다? Capgo 앱 ID와 채널은 동일하게 유지하고 클라이언트 플러그인 패키지만 변경한다.