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用コピーYou can use our AI-Assisted Setup to install the plugin. Add the Capgo skills to your AI tool using the following command:
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ではバンドル識別子です。デバッグとリリースビルドが異なるパッケージ識別子を使用している場合でも、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のインストールに異なる署名キーを使用することもできます。
- iOSはアプリの更新やiOSの更新を乗り切ることができ、Keychainアクセス規則は同じままです。
- WebはlocalStorageを使用し、開発用のフォールバックのみです。
「Getting Started」から続けてください
「「Getting Started」から続けてください」のセクションCapgoを使用している場合 Getting Started 永続的なアプリケーションIDを追加するには、 @capgo/capacitor-persistent-uuid 概要の場合、 Androidの動作 再インストールの動作の場合、 iOSの動作 キーチェーンの動作の場合、 Capgoを使用して@capgo/capacitor-persistent-uuid チュートリアルの場合、 Capgo プラグイン ディレクトリ 他のネイティブ プラグインについて。