npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

sms-read-plugin-android

v0.0.3

Published

A plugin used to read sms for android apps

Readme

sms-read-plugin-android

A plugin used to read sms for android apps

Install

To use npm

npm install sms-read-plugin-android

To use yarn

yarn add sms-read-plugin-android

Sync native files

npx cap sync

API

startListening(...)

startListening(options?: StartListeningOptions | undefined) => Promise<SmsReceivedResult>

Start the SMS User Consent flow.

Registers with Google Play Services (SmsRetrieverClient.startSmsUserConsent) and waits for a single incoming SMS. When a matching message arrives the system shows a one-tap consent dialog; if the user allows it, the promise resolves with the full message body and (best-effort) the extracted OTP.

This is a one-shot operation: it resolves/rejects exactly once and then stops listening. Call it again to listen for the next message. Internally it times out after ~5 minutes (enforced by Play Services).

Requires NO SMS permissions and NO app hash.

| Param | Type | | ------------- | ----------------------------------------------------------------------- | | options | StartListeningOptions |

Returns: Promise<SmsReceivedResult>


stopListening()

stopListening() => Promise<void>

Stop an in-progress startListening call early.

Unregisters the broadcast receiver and rejects any pending startListening promise with code CANCELLED.


addListener('smsReceived', ...)

addListener(eventName: 'smsReceived', listenerFunc: (event: SmsReceivedResult) => void) => Promise<PluginListenerHandle>

Listen for a received SMS. Fires in addition to the startListening promise resolving, for consumers that prefer an event-based API.

| Param | Type | | ------------------ | ----------------------------------------------------------------------------------- | | eventName | 'smsReceived' | | listenerFunc | (event: SmsReceivedResult) => void |

Returns: Promise<PluginListenerHandle>


addListener('smsError', ...)

addListener(eventName: 'smsError', listenerFunc: (event: SmsErrorEvent) => void) => Promise<PluginListenerHandle>

Listen for errors during the consent flow (timeout, denied consent, etc.).

| Param | Type | | ------------------ | --------------------------------------------------------------------------- | | eventName | 'smsError' | | listenerFunc | (event: SmsErrorEvent) => void |

Returns: Promise<PluginListenerHandle>


removeAllListeners()

removeAllListeners() => Promise<void>

Remove all registered listeners for this plugin.


Interfaces

SmsReceivedResult

| Prop | Type | Description | | ------------- | ------------------- | ---------------------------------------------------------------------- | | message | string | The full text of the SMS the user consented to share. | | otp | string | The OTP extracted from message using otpPattern, if one was found. |

StartListeningOptions

| Prop | Type | Description | | ----------------------- | ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | senderPhoneNumber | string | If set, only messages originating from this phone number trigger the consent prompt. Leave undefined to accept a message from any sender. | | otpPattern | string | Custom regular expression (as a string) used to extract the OTP from the message body. The first capturing group is preferred; otherwise the whole match is used. Defaults to \d{4,8} (a 4–8 digit run). |

PluginListenerHandle

| Prop | Type | | ------------ | ----------------------------------------- | | remove | () => Promise<void> |

SmsErrorEvent

| Prop | Type | Description | | ------------- | ----------------------------------------------------- | ---------------------------------------------- | | code | SmsErrorCode | Stable machine-readable error code. | | message | string | Human-readable description of what went wrong. |

Type Aliases

SmsErrorCode

'TIMEOUT' | 'CONSENT_DENIED' | 'NO_MESSAGE' | 'CANCELLED' | 'API_ERROR'