Guide
Tutorial on Android SMS Retriever
Using @capgo/capacitor-android-sms-retriever
@capgo/capacitor-android-sms-retriever provides Android SMS Retriever and Phone Number Hint APIs for Capacitor apps.
Use it when you need passwordless phone verification without asking for SMS permissions. Android listens for one app-targeted verification SMS for up to five minutes and returns the message through Capacitor listeners.
Install
bun add @capgo/capacitor-android-sms-retriever
bunx cap sync android
What This Plugin Exposes
startWatchstarts the Android SMS Retriever watch.stopWatchstops the active watch.getHashStringreturns the app hash required in verification SMS messages.getPhoneNumberopens Android Phone Number Hint for SIM-based phone number selection.smsReceived,smsRetrieverTimeout, andsmsRetrieverErrorevents 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, Getting Started for the implementation detail in Getting Started, Capgo Plugin Directory for the product workflow in Capgo Plugin Directory, Capacitor Plugins by Capgo for the implementation detail in Capacitor Plugins by Capgo, and Adding or Updating Plugins for the implementation detail in Adding or Updating Plugins.