가이드
__CAPGO_KEEP_0__에서 Persistent UUID에 대한 튜토리얼
capgo/capacitor-persistent-uuid를 사용하여 capgo의 Persistent UUID를 생성하고 재설치 및 업데이트 흐름에서 일반 앱 저장소가 제거되는 동안 안정적인 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
- scope - 앱의 debug 및 production 패키지 식별자가 다를 경우 옵션 네임 스페이스
예시 사용
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는 패키지 이름이나 커스텀 스코프가 안정적일 때 Android Studio 재설치 주기 및 debug vs Play signing 차이점을survive 할 수 있도록 AccountManager에 UUID를 저장합니다. iOS는 Keychain에 UUID를 저장하고 앱 및 iOS 업데이트를 통해 Keychain 접근이 호환되는 동안 유지됩니다. Web은 개발용 fallback으로 localStorage를 사용합니다.
이 플러그인은 하드웨어 ID를 노출하지 않으며 factory reset, manual account 삭제, Keychain 클리어링, 브라우저 저장소 클리어링, 또는 resetId에 의해 살아남지 않습니다.
전체 참조
- GitHub: https://github.com/Cap-go/capacitor-persistent-uuid/
- Docs: /docs/plugins/persistent-uuid/
계속 진행
이미 사용 중이라면 @capgo/capacitor-persistent-uuid 앱의 고유성을 안정적으로 유지하기 위해 연결하세요. @capgo/capacitor-persistent-uuid 개요를 위해 Getting Started 설치 및 API 예시를 위해 Android 동작 재설치 세부 정보를 위해 iOS 동작 Keychain 세부 정보를 위해, 그리고 @capgo/capacitor-persistent-account UUID 대신 계정 데이터의 지속성을 필요로 할 때