はじめて
このプラグインのインストール手順とフル マークダウン ガイドの全てのステップを含むセットアップ用質問をコピーしてください。
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.
インストール
「インストール」というタイトルのセクション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-android-sms-retriever` plugin in my project.Manualセットアップを使用する場合は、以下のコマンドを実行してプラグインをインストールし、以下のプラットフォーム固有の指示に従ってください。
bun add @capgo/capacitor-android-sms-retrieverbunx cap sync androidimport { AndroidSmsRetriever } from '@capgo/capacitor-android-sms-retriever';Android の要件
Section titled “Android の要件”SMS Retriever は Android デバイス上の Google Play サービスが必要です。プラグインは、または許可を要求しません。 READ_SMS あなたの確認用 SMS は、 RECEIVE_SMS で返されたアプリハッシュを含む必要があります。
署名キーで配布されるアプリのハッシュを生成してください。デバッグ、リリース、Play App Signing ビルドは異なるハッシュを持つことができます。 getHashString()確認用 SMS を待つ
Section titled “確認用 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);__CAPGO_KEEP_0__
電話番号ヒントを要求
セクション「電話番号ヒントを要求」const { phoneNumber } = await AndroidSmsRetriever.getPhoneNumber();console.log(phoneNumber);Androidは、ユーザーが選択した電話番号を返すネイティブの電話番号ヒントUIを表示します。
例:SMS
例のSMSセクション<#> 123456 is your verification code.FA+9qCX9VSuアプリ署名キーでハッシュを置き換えてください。
Getting Startedから続けてください
Getting Startedから続けてくださいあなたが使用している場合 Getting Started ネイティブプラグインの作業を計画するには、 ネイティブ機能の「@capgo/capacitor-android-sms-retriever」 「@capgo/capacitor-android-sms-retriever」のネイティブ機能 Capgo プラグインディレクトリ Capgo プラグインディレクトリの製品ワークフロー Capacitor Plugins by Capgo for the implementation detail in Capacitor Plugins by Capgo, __CAPGO_KEEP_0__ プラグイン __CAPGO_KEEP_1__ によって プラグインの追加または更新 プラグインの追加または更新の実装詳細については、