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.
インストール
「インストール」のセクションCapgoのAIアシストセットアップを使用してプラグインをインストールできます。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-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ではバンドル識別子です。デバッグとリリースビルドが異なるパッケージ識別子を使用している場合でも、共有するUUIDを使用するには共有スコープを指定してください。
const result = await PersistentUuid.getId({ scope: 'com.example.app',});UUIDをリセットする
UUIDをリセットするユーザーがログアウトしたとき、プライバシーをリセットしたとき、または自動テストで新しい識別子が必要なときは、resetIdを呼び出してください。
const replacement = await PersistentUuid.resetId();console.log(replacement.id);パERSISTENCEの期待値
パッケージ名またはカスタムスコープが安定している場合、Androidはアンインストールと再インストールを乗り切ることができ、Android StudioとPlayのインストールに異なる署名キーが使用される場合も同様です。- iOSはアプリの更新とiOSの更新を乗り切ることができ、Keychainアクセス規則は同じままです。
- WebはlocalStorageを使用し、開発用のフォールバックのみです。
- Getting Startedから続けてください
「Getting Startedから続けてください」のセクション
Capacitorを使用している場合Getting Started Getting Started 持続的なアプリケーションIDを追加するには、接続する @capgo/capacitor-persistent-uuid 概要のため Androidの動作 再インストールの動作 iOSの動作 キーチェーンの動作 Using @capgo/capacitor-persistent-uuid チュートリアルのため Capgo Plugin Directory その他のネイティブ プラグイン