Using @capgo/capacitor-android-sms-retriever
@capgo/capacitor-android-sms-retriever Android SMS Retriever と Phone Number Hint API を提供します。Capacitor アプリ向けです。
Capacitor アプリでパスワードなしの電話認証を実現するために、SMS の許可を求めずに使用してください。Android は、最大 5 分間、1 つのアプリをターゲットにした検証メッセージを待ち、Capacitor リスナーの通じてメッセージを返します。
インストール
bun add @capgo/capacitor-android-sms-retriever
bunx cap sync android
このプラグインが公開するもの
startWatchAndroid SMS Retriever のウォッチを開始します。stopWatchアクティブなウォッチを停止します。getHashString検証 SMS メッセージに必要なアプリのハッシュを返します。getPhoneNumberSIM ベースの電話番号選択用の Android Phone Number Hint を開きます。smsReceived,smsRetrieverTimeout、smsRetrieverErrorevents cover the verification lifecycle.
Example Usage
import { AndroidSmsRetriever } from '@capgo/capacitor-android-sms-retriever';
const { hash } = await AndroidSmsRetriever.getHashString();
console.log('SMS hash:', hash);
await AndroidSmsRetriever.addListener('smsReceived', ({ message }) => {
console.log('Verification SMS:', message);
});
await AndroidSmsRetriever.startWatch();
Phone Number Hint
const { phoneNumber } = await AndroidSmsRetriever.getPhoneNumber();
console.log(phoneNumber);
Full Reference
- GitHub https://github.com/Cap-go/capacitor-android-sms-retriever/
- Docs: /docs/plugins/android-sms-retriever/
Keep going from Using @capgo/capacitor-android-sms-retriever
If you are using Using @capgo/capacitor-android-sms-retriever to plan native plugin work, connect it with @capgo/capacitor-android-sms-retriever for the implementation detail in @capgo/capacitor-android-sms-retriever, はじめに for the implementation detail in はじめに, Capgo プラグイン ディレクトリ for the product workflow in Capgo プラグイン ディレクトリ, Capacitor プラグイン by Capgo for the implementation detail in Capacitor プラグイン by Capgo, and プラグインの追加または更新 for the implementation detail in プラグインの追加または更新。