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-android-sms-retriever`
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/android-sms-retriever/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-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-android-sms-retriever` plugin in my project.Manual Setupを使用する場合は、以下のコマンドを実行してプラグインをインストールし、以下のプラットフォーム固有の指示に従ってください。
bun add @capgo/capacitor-android-sms-retrieverbunx cap sync androidインポート
「インポート」のセクションimport { AndroidSmsRetriever } from '@capgo/capacitor-android-sms-retriever';Androidの要件
「Androidの要件」のセクションSMS Retrieverは、AndroidデバイスにGoogle Playサービスが必要です。プラグインは、次のことを要求しません。 READ_SMS または RECEIVE_SMS SMS Retrieverには、AndroidデバイスにGoogle Playサービスが必要です。プラグインは、SMSの取得を要求しません。SMSの取得には、SMS Retrieverの設定が必要です。
SMSの取得には、SMS Retrieverの設定が必要です。SMSの取得には、SMSの取得を許可するSMS Retrieverの設定が必要です。 getHashString()SMSの取得には、SMSの取得を許可するSMS Retrieverの設定が必要です。SMSの取得には、SMSの取得を許可するSMS Retrieverの設定が必要です。SMSの取得には、SMSの取得を許可するSMS Retrieverの設定が必要です。
SMSの検証を待つ
「SMSの検証を待つ」セクションimport { AndroidSmsRetriever } from '@capgo/capacitor-android-sms-retriever';
const received = await AndroidSmsRetriever.addListener('smsReceived', ({ message }) => { const code = message.match(/\b\d{6}\b/)?.[0]; console.log('Verification code:', code);});
const timeout = await AndroidSmsRetriever.addListener('smsRetrieverTimeout', () => { console.log('SMS Retriever timed out');});
const errors = await AndroidSmsRetriever.addListener('smsRetrieverError', ({ message }) => { console.error('SMS Retriever error:', message);});
await AndroidSmsRetriever.startWatch();
// Remove listeners when the verification flow is done.await received.remove();await timeout.remove();await errors.remove();視聴を停止
「視聴を停止」セクションawait AndroidSmsRetriever.stopWatch();アプリハッシュを取得
「アプリハッシュを取得」セクションconst { hash } = await AndroidSmsRetriever.getHashString();console.log(hash);バックエンドから送信される検証SMSの末尾にこのハッシュを使用します。
電話番号のヒントを要求
「電話番号のヒントを要求」セクションconst { phoneNumber } = await AndroidSmsRetriever.getPhoneNumber();console.log(phoneNumber);Androidはユーザーが選択した電話番号を返すために、ネイティブの電話番号ヒントUIを表示します。
例のSMS
「例のSMS」のセクション<#> 123456 is your verification code.FA+9qCX9VSuアプリ署名キーでハッシュを置き換えます。
「Getting Started」から続きます
「Getting Started」から続きますCapacitorを使用している場合 Capacitorを使用している場合 Capacitorを使用している場合、@__CAPGO_KEEP_0__/__CAPGO_KEEP_1__-android-sms-retrieverと接続します Using @capgo/capacitor-android-sms-retriever Capacitorのネイティブ機能の使用に@capgo/capacitor-android-sms-retrieverを使用します。 Capgo プラグインディレクトリ Capgo プラグインの製品ワークフロー Capacitor プラグインのCapgo Capacitor プラグインのCapgoの実装詳細 プラグインの追加または更新 __CAPGO_KEEP_0__ プラグインの__CAPGO_KEEP_1__の実装詳細 Capacitorエンタープライズプラグインの代替 __CAPGO_KEEP_0__ プラグインの代替の製品ワークフロー