コンテンツにジャンプ

はじめて

GitHub

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-retriever
bunx cap sync android
import { AndroidSmsRetriever } from '@capgo/capacitor-android-sms-retriever';

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を表示します。

<#> 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__ によって プラグインの追加または更新 プラグインの追加または更新の実装詳細については、