メニューに進む

Getting Started

GitHub

ソースガイド

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-uuid
npx cap sync
import { PersistentUuid } from '@capgo/capacitor-persistent-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',
});

ユーザーがログアウトしたとき、プライバシーをリセットしたとき、または自動テストで新しい識別子が必要になったときに、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 プラグイン ディレクトリ 他のネイティブ プラグインについて。