Getting Started
インストール手順と完全なマークダウンガイドを含むセットアップ用の質問をコピーしてください。
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-persistent-uuid`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/persistent-uuid/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
インストール
Installnpm install @capgo/capacitor-persistent-uuidnpx 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が返される
スコープを安定させる
スコープを安定させるAndroidとiOSでは、デフォルトスコープはパッケージ名とバンドルIDです。デバッグとリリースビルドが異なるパッケージIDを使用する場合、共有スコープを渡して1つのUUIDを共有します。
const result = await PersistentUuid.getId({ scope: 'com.example.app',});UUIDをリセット
UUIDをリセットのセクションユーザーがログアウトしたり、プライバシーをリセットしたり、自動テストで新しいIDが必要になったりするときは、resetIdを呼び出してください。
const replacement = await PersistentUuid.resetId();console.log(replacement.id);パーシステンスの期待
パーシステンスの期待のセクション- Androidでは、パッケージ名またはカスタムスコープが安定している場合、アンインストールと再インストール、Android Studio、Playインストール、異なる署名キーを使用した場合に生存します。
- iOSでは、アプリの更新とiOSの更新が発生しても、Keychainアクセス規則が同じの場合に生存します。
- WebではlocalStorageを使用し、開発用のフォールバックのみです。
Getting Startedから続けてください
「Getting Started」から続けてくださいあなたは「Getting Started」を使用している場合 Getting Started 永続的なアプリケーションIDを追加するには、@__CAPGO_KEEP_0__/__CAPGO_KEEP_1__-persistent-uuidと接続します 概要の場合、@capgo/capacitor-persistent-uuid Androidの動作 再インストールの動作 iOSの動作 キーチェーンの動作 「@__CAPGO_KEEP_0__/__CAPGO_KEEP_1__-persistent-uuid」を使用してチュートリアル 「@capgo/capacitor-persistent-uuid」 @__CAPGO_KEEP_0__/__CAPGO_KEEP_1__-persistent-uuid Capgo プラグイン ディレクトリ 他のネイティブ プラグイン用