내용으로 건너뛰기

Cordova 업데이터 사용자 가이드

GitHub

이 안내서에서는 Cordova 앱에 @capgo/cordova-updater to a Cordova app so you can receive Capgo live updates on iOS and Android.

Cordova __CAPGO_KEEP_0__ 12+

__CAPGO_KEEP_0__

설치

설치
  1. npm에서 플러그인을 설치하고 Capgo 앱 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, 플러그인은 다음으로 사용할 수 있습니다 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/ 스킴.
  • 다운로드 된 패키지 자산을 제공하기 위해 플러그인을 등록합니다. CordovaPluginPathHandler Cordova iOS 7 이상이 필요하여 기본 스킴으로 제공됩니다.

Cordova

13

Build your web assets, then upload with the Capgo CLI (same workflow as Capacitor):

터미널 창
bun run build
bunx @capgo/cli@latest bundle upload --channel=production

다음 단계

다음 단계
  • __CAPGO_KEEP_0__ 업데이터 구성 Capacitor 변수. plugin.xml 읽기
  • 라이브 업데이트 호환성 native plugin 변경 사항을 배송하기 전에 읽어야 합니다. __CAPGO_KEEP_1__ 앱 ID와 채널을 동일하게 유지하고 클라이언트 플러그인 패키지만 변경합니다.
  • Migrating to Capacitor later? Keep the same Capgo app ID and channels; only the client plugin package changes.