はじめから
このプラグインのインストールステップとフルマークダウンガイドの全てのステップを含む設定の質問をコピーする
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.
Install
Section titled “Install”bun add @capgo/capacitor-android-sms-retrieverbunx cap sync androidImport
Section titled “Import”import { AndroidSmsRetriever } from '@capgo/capacitor-android-sms-retriever';Android Requirements
Android の要件Android デバイス上の Google Play サービスが必要です。プラグインは、SMS リトリーバーに必要な "SMS リトリーバー" などのパーミッションを要求しません。 READ_SMS 、 RECEIVE_SMS SMS の検証に使用するアプリのハッシュが含まれている必要があります。このハッシュは、配布するアプリの署名キーから生成する必要があります。デバッグ、リリース、Play App Signing ビルドは異なるハッシュを持つことができます。
SMS の検証を待つ getHashString()セクションのタイトル “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を使用している場合 Getting Started ネイティブ プラグインの作業を計画するには、Capacitorを使用して Capacitorを使用して「@capgo/capacitor-android-sms-retriever」を接続する 「@capgo/capacitor-android-sms-retriever」を使用するネイティブ機能 「@Capgo/__CAPGO_KEEP_1__-android-sms-retriever」を使用するネイティブ機能 Capgo プラグイン ディレクトリ Capacitor Plugins by Capgo for the implementation detail in Capacitor Plugins by Capgo, __CAPGO_KEEP_0__ プラグイン 実装詳細の追加または更新の際の詳細については、 Ionic Enterprise プラグインの代替 Ionic Enterprise プラグインの製品ワークフローについては、