가이드
__CAPGO_KEEP_1__ Persistent UUID 튜토리얼
Capacitor에서 @capgo/capacitor-persistent-uuid 사용
Capacitor에 대해 재설치 및 업데이트 흐름에서 일반 앱 저장소가 삭제되는 동안 앱 스코프 UUID를 생성하고 유지
설치
npm install @capgo/capacitor-persistent-uuid
npx cap sync
이 플러그인은 노출합니다.
- getId - 저장된 UUID를 읽어, 선택한 범위에 대해 하나가 없으면 하나를 만듭니다.
- resetId - 로그아웃, 개인 정보 초기화, 테스트 청소 흐름을위한 저장된 UUID를 회전합니다.
- 범위 - 패키지 식별자가 다를 경우 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 할 수 있습니다. iOS는 Keychain에 UUID를 저장하고 앱 및 iOS 업데이트를 통해 Keychain 접근이 호환되면 유지됩니다. Web은 개발용으로 localStorage를 사용합니다.
이 플러그인은 하드웨어 ID를 노출하지 않으며 factory reset, 수동 계정 제거, Keychain 초기화, 브라우저 저장소 초기화, 또는 resetId를 통해 살아남지 않습니다.
전체 참조
- GitHub: https://github.com/Cap-go/capacitor-persistent-uuid/
- 문서: /docs/plugins/persistent-uuid/
계속 진행하기
Capgo를 사용 중이라면 @capgo/capacitor-persistent-uuid 앱 식별성을 안정적으로 유지하기 위해 연결하세요. @capgo/capacitor-persistent-uuid 개요를 위해, Getting Started for install and API examples, Android 동작 재설치에 대한 자세한 내용을 위해, iOS 동작 Keychain 세부 사항과 함께 @capgo/capacitor-영구 계정 __CAPGO_KEEP_0__에서 UUID 대신 계정 데이터 영구성을 필요로 할 때