UUIDをリセットする
このプラグインのインストール手順と完全なマークダウンガイドを含む設定の質問をコピーする
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.
Install
「インストール」のセクションCapgoの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を使用する場合は、以下のコマンドを実行してプラグインをインストールし、以下のプラットフォーム固有の指示に従ってください。
bun add @capgo/capacitor-persistent-uuidbunx 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をリセットする
Reset UUIDログアウト、プライバシー再設定、または自動テストで新しい識別子が必要な場合に、resetIdを呼び出してください。
const replacement = await PersistentUuid.resetId();console.log(replacement.id);保存の期待値
保存の期待値- Androidは、パッケージ名またはカスタムスコープが安定している場合、アンインストールと再インストールを乗り切ることができます。Android StudioとPlayのインストールに異なる署名キーが使用される場合も同様です。
- iOSは、Keychainアクセス規則が同じである限り、アプリの更新とiOSの更新を乗り切ることができます。
- WebはlocalStorageを使用し、開発用のフォールバックのみです。
続けてGetting Started
Section titled “続けてGetting Started”あなたが使用している はじめに 持続的なアプリケーションIDを追加するには、接続する @capgo/capacitor-パーシステントUUID 概要のために Androidの動作 再インストールの動作 iOSの動作 キーチェーンの動作 @capgo/capacitor-パーシステントUUID チュートリアル用 Capgo プラグインディレクトリ 他のネイティブプラグイン用