메인 콘텐츠로 건너뛰기
플러그인으로 돌아가기
@capgo/capacitor-persistent-uuid
튜토리얼
@capgo/capacitor-persistent-uuid

UUID가 유지되는 플러그인

앱이 다시 설치되거나 업데이트되거나 운영 체제가 업데이트될 때 앱 스코프 내에서 하나의 UUID를 생성하고 유지합니다.

가이드

__CAPGO_KEEP_0__에서 지속적인 UUID에 대한 튜토리얼

capgo/capacitor-persistent-uuid를 사용하여 capgo에 하나의 지속적인 앱 범위 UUID를 생성하고 재설치 및 업데이트 흐름에서 일반 앱 저장소가 삭제되는 동안 안정적으로 유지합니다.

Generate one persistent app-scoped UUID for Capacitor and keep it stable across reinstall and update flows where normal app storage is removed.

이 플러그인이 노출하는 것

npm install @capgo/capacitor-persistent-uuid
npx cap sync

getId - 선택한 범위에 대해 저장된 UUID를 읽어, 하나가 없으면 생성합니다.

  • resetId - 로그아웃, 개인 정보 초기화, 테스트 청소 흐름에서 저장된 UUID를 회전합니다.
  • scope - 앱의 디버그 및 프로덕션 패키지 식별자가 다를 경우 옵션 네임스페이스
  • __CAPGO_KEEP_0__

Example Usage

import { PersistentUuid } from '@capgo/capacitor-persistent-uuid';

const { id, created, scope } = await PersistentUuid.getId();

console.log(id);
console.log(created);
console.log(scope);

__CAPGO_KEEP_0__

const result = await PersistentUuid.getId({
  scope: 'com.example.app',
});

console.log(result.id);

__CAPGO_KEEP_0__

const replacement = await PersistentUuid.resetId();
console.log(replacement.id);

Platform Notes

Android는 패키지 이름이나 커스텀 스코프가 안정적일 때 Android Studio 재설치 주기 및 debug vs Play signing 차이점을 버텨내고 AccountManager에 UUID를 저장합니다. iOS는 Keychain에 UUID를 저장하고 앱 및 iOS 업데이트를 통해 Keychain 접근이 호환되는 동안 유지합니다. Web은 개발용으로 localStorage를 사용합니다.

이 플러그인은 하드웨어 ID를 노출하지 않으며 Keychain 클리어링, 브라우저 저장소 클리어링, 또는 resetId로 인해 생존하지 않습니다.

Full Reference

Keep Going

If you are using @capgo/capacitor-persistent-uuid 앱 식별성을 안정적으로 유지하기 위해 연결하세요. @capgo/capacitor-persistent-uuid 개요를 위해. Getting Started 설치 및 API 예시를 위해. Android 동작 재설치에 대한 세부 정보를 위해. iOS 동작 Keychain에 대한 세부 정보를 위해. @capgo/capacitor-persistent-account UUID 대신 계정 데이터를 지속적으로 유지할 필요가 있는 경우.