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