안내
Persistent UUID에 대한 튜토리얼
Persistent UUID를 사용하는 방법: @capgo/capacitor-persistent-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 - 앱의 debug 및 production 패키지 식별자가 다를 경우 옵션 namespace입니다.
예시 사용
import { PersistentUuid } from '@capgo/capacitor-persistent-uuid';
const { id, created, scope } = await PersistentUuid.getId();
console.log(id);
console.log(created);
console.log(scope);
빌드 버전 간에 하나의 UUID를 공유하세요
const result = await PersistentUuid.getId({
scope: 'com.example.app',
});
console.log(result.id);
식별자 초기화
const replacement = await PersistentUuid.resetId();
console.log(replacement.id);
플랫폼 주의사항
Android는 패키지 이름 또는 커스텀 scope이 안정적일 때 Android Studio 재설치 주기와 debug vs Play signing 차이점을survive 할 수 있도록 AccountManager에 UUID를 저장합니다. iOS는 Keychain에 UUID를 저장하고 앱 및 iOS 업데이트를 통해 Keychain 접근이 호환되면 유지됩니다. Web은 개발용 fallback으로 localStorage를 사용합니다.
이 플러그인은 하드웨어 ID를 노출하지 않으며 factory reset, 수동 계정 제거, Keychain 초기화, 브라우저 저장소 초기화, resetId를 통해 살아남지 않습니다.
전체 참조
- GitHub: https://github.com/Cap-go/capacitor-persistent-uuid/
- 문서: /docs/plugins/persistent-uuid/
계속 진행
이 __CAPGO_KEEP_0__을 사용 중이라면 @capgo/capacitor-persistent-uuid __CAPGO_KEEP_0__을 사용하여 앱의 고유성을 안정적으로 유지하고 싶다면 __CAPGO_KEEP_0__-persistent-uuid @capgo/capacitor-persistent-uuid Getting Started 설치 및 __CAPGO_KEEP_0__ 예제에 대한 for install and API examples, 재설치에 대한 세부 정보 iOS의 동작 Keychain에 대한 세부 정보 및 capgo-capacitor-persistent-account UUID 대신 계정 데이터 영속성을 필요로 할 때.