내용으로 건너뛰기

Getting Started

GitHub

AI-Assisted Setup을 사용하여 플러그인을 설치할 수 있습니다. AI 도구에 Capgo 스킬을 추가하려면 다음 명령어를 사용하세요:

터미널 창
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins

다음과 같은 프롬프트를 사용하세요:

Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-persistent-uuid` plugin in my project.

만약 Manual Setup을 선호한다면, 플러그인을 설치하기 위해 다음 명령어를 실행하고 아래의 플랫폼별 지침을 따르세요:

터미널 창
npm install @capgo/capacitor-persistent-uuid
npx cap sync
import { PersistentUuid } from '@capgo/capacitor-persistent-uuid';

UUID를 읽거나 생성하세요

UUID를 읽거나 생성하는 섹션
import { PersistentUuid } from '@capgo/capacitor-persistent-uuid';
const result = await PersistentUuid.getId();
console.log(result.id);
console.log(result.scope);
console.log(result.created);

첫 번째 호출은 UUID를 생성하고 저장합니다. 나중에 호출은 동일한 범위에 대해 동일한 UUID를 반환합니다.

안정적인 커스텀 범위 사용

안정적인 커스텀 범위 사용 섹션

기본 범위는 native default scope입니다. Android는 패키지 이름, iOS는 번들 식별자입니다. debug 및 production 빌드가 서로 다른 패키지 식별자를 사용하지만 하나의 UUID를 공유해야 하는 경우 공유 범위를 전달하세요.

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

UUID를 초기화하세요

UUID 초기화

사용자가 로그아웃하거나 개인 정보 초기화를 요청하거나 자동화된 테스트에서 새로운 식별자가 필요할 때 resetId를 호출하세요.

const replacement = await PersistentUuid.resetId();
console.log(replacement.id);
  • Android는 패키지 이름 또는 커스텀 범위가 동일할 때 Android Studio와 Play 설치와 다른 서명 키를 사용하는 Android Studio와 Play 설치를 포함하여 다시 설치할 수 있습니다.
  • iOS는 앱 업데이트와 iOS 업데이트를 포함하여 Keychain 접근 규칙이 동일할 때 앱 업데이트를 견딤니다.
  • Web은 localStorage를 사용하고 개발용으로만 fallback입니다.

Getting Started에서 계속하세요

개발을 시작한 경우

Section titled “If you are using” Getting Started __CAPGO_KEEP_0__을 위한 지속적인 앱 식별성을 추가하기 위해 연결하세요. @capgo/capacitor-persistent-uuid __CAPGO_KEEP_0__ 개요 Android 동작 __CAPGO_KEEP_0__ 재설치 동작 iOS 동작 __CAPGO_KEEP_0__ Keychain 동작 @capgo/capacitor-persistent-uuid를 사용하세요. __CAPGO_KEEP_0__ 튜토리얼을 위해 Capgo 플러그인 디렉토리 __CAPGO_KEEP_0__ 다른 네이티브 플러그인.