본문으로 이동
Back to 플러그인
@capgo/cordova-updater
튜토리얼
@capgo/cordova-updater

Cordova 업데이터

iOS 및 Android의 Cordova에 대한 OTA 실시간 업데이트와 API-업데이터와 동일한 capacitor

가이드

Cordova Updater에 대한 튜토리얼

@capgo/cordova-updater를 사용하여

@capgo/cordova-updater Cordova iOS 및 Android 앱에 Capgo 라이브 업데이트를 제공하며 JavaScript API를 사용하여 @capgo/capacitor-updater Cordova 플러그인을 설치하고 notifyAppReady() launch마다 호출하고 @capgo/cli.

업로드할 배ंडल과 함께

cordova plugin add @capgo/cordova-updater --variable APP_ID=com.example.app
cordova prepare android ios

설치하기

document.addEventListener('deviceready', async () => {
  const { Updater } = cordova.plugins;

  await Updater.notifyAppReady();

  const { bundle } = await Updater.current();
  console.log('Active bundle', bundle);

  const latest = await Updater.getLatest();
  if (latest.url && !latest.error) {
    const downloaded = await Updater.download({
      url: latest.url,
      version: latest.version,
      checksum: latest.checksum,
    });

    await Updater.next({ id: downloaded.id });
  }
});

플랫폼 요구 사항

  • Cordova Android 13+ 및 Cordova iOS 7+
  • 기본 Cordova WebView 스키마 (https://localhost/ 안드로이드에서 app://localhost/ iOS에서
  • 피하기 cordova-plugin-ionic-webview — 이 prevents bundle swapping

새로운 배포

bun run build
bunx @capgo/cli@latest bundle upload --channel=production

실용적인 조언

  • Reuse same Capgo 앱 ID 및 채널을 사용하여 Capacitor 또는 Electron 클라이언트도 배포한다면.
  • 자연 플러그인 또는 Cordova 플랫폼 업그레이드를 다른 네이티브 변경과 같이 처리하십시오: 새로운 스토어 바이너리를 배포하고 네이티브 API를 사용하기 전에 자바스크립트 배포를 의존하지 마십시오.
  • 전체 설정 세부 사항은 Cordova 업데이터 문서.