내용으로 건너뛰기

다음 단계

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__
  • CLI
  • 안드로이드 13 이상 및/또는 iOS 7 이상 Cordova
  • 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. Optional: override defaults at install time (same variables as the Capacitor updater):

    터미널 창
    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

JavaScript 사용법

JavaScript 사용법

그 후 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.
  • 다운로드 된 패키지 자산을 제공하기 위해 플러그인을 등록합니다. CordovaPluginPathHandler Cordova iOS 7 이상이 필요하여 기본

웹 자산을 빌드한 후 __CAPGO_KEEP_0__ __CAPGO_KEEP_1__ (__CAPGO_KEEP_2__와 동일한 워크플로우)로 업로드하세요.

Build your web assets, then upload with the __CAPGO_KEEP_0__ __CAPGO_KEEP_1__ (same workflow as __CAPGO_KEEP_2__):

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

다음 단계

다음 단계