내용으로 건너뛰기

Cordova 업데이터 사용 시작

GitHub

이 가이드는 플러그인을 추가하는 방법을 안내합니다. @capgo/cordova-updater to a Cordova app so you can receive Capgo live updates on iOS and Android.

설치

설치
  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/ scheme.
  • The plugin registers a CordovaPluginPathHandler 다운로드 된 배포물 자산을 제공하기 위해

첫 번째 배포물 업로드

제목 “첫 번째 배포물 업로드”

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

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

다음 단계

Next steps