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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@solimanware/capacitor-sms-reader

v5.0.3

Published

A capacitor plugin to read SMS inbox

Downloads

108

Readme

capacitor-sms-inbox

A Capacitor plugin to read SMS inbox on Android devices.

Installation

  1. Install the plugin:
npm i git+https://github.com/solimanware/capacitor-sms-reader.git
  1. Sync your Capacitor project:
npx cap sync android
  1. Add the following permissions to your AndroidManifest.xml file:
<uses-permission android:name="android.permission.READ_SMS" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
  1. In your Capacitor config file (usually capacitor.config.json or capacitor.config.ts), add the following:
{
  "plugins": {
    "SMSInboxReader": {
      "android": {
        "name": "com.capacitor.sms.reader.SMSInboxReaderPlugin"
      }
    }
  }
}
  1. Import and initialize the plugin in your TypeScript/JavaScript code:
import { Plugins } from '@capacitor/core';
import { SMSInboxReader } from 'capacitor-sms-reader';

// Use the plugin
const { SMSInboxReader } = Plugins;

// Check permissions
const permissionStatus = await SMSInboxReader.checkPermissions();
if (permissionStatus.sms !== 'granted') {
  await SMSInboxReader.requestPermissions();
}

// Now you can use other methods like getCount(), getSMSList(), etc.

Usage

After installation, you can use the plugin's methods to interact with the SMS inbox. Remember to always check and request permissions before accessing SMS data.

For detailed API documentation, see the API section below.

API

Plugin interface for reading messages from the device's inbox.

getMessages(...)

getMessages(filter: GetMessageFilterInput) => Promise<{ messages: MessageObject[]; }>

Retrieves messages based on the provided filter criteria.

| Param | Type | Description | | ------------ | ----------------------------------------------------------------------- | ------------------------------------------------------ | | filter | GetMessageFilterInput | - The filter criteria to apply when fetching messages. |

Returns: Promise<{ messages: MessageObject[]; }>


checkPermissions()

checkPermissions() => Promise<PermissionStatus>

Checks the current permission status for accessing messages.

Returns: Promise<PermissionStatus>


requestPermissions()

requestPermissions() => Promise<PermissionStatus>

Requests permissions to access messages on the device.

Returns: Promise<PermissionStatus>


Interfaces

MessageObject

Represents a message object with its properties.

| Prop | Type | Description | | ----------------- | --------------------------- | ----------------------------------------------------- | | id | string | Unique identifier of the message. | | date | number | Timestamp of the message in milliseconds since epoch. | | messageType | 'sms' | 'mms' | Type of the message, either 'sms' or 'mms'. | | sender | string | Phone number or address of the sender/recipient. | | body | string | Content of the message. |

GetMessageFilterInput

Input parameters for filtering messages.

| Prop | Type | Description | | --------------- | --------------------- | -------------------------------------------------------------- | | ids | string[] | Array of message IDs to filter by. | | body | string | Text to search for in the message body. | | sender | string | Phone number or address to filter by. | | minDate | number | Minimum date (in milliseconds since epoch) to filter messages. | | maxDate | number | Maximum date (in milliseconds since epoch) to filter messages. | | indexFrom | number | Starting index for pagination. | | indexTo | number | Ending index for pagination. | | limit | number | Maximum number of messages to return. |

PermissionStatus

Represents the permission status for accessing messages.

| Prop | Type | Description | | -------------- | ----------------------------------------------------------- | ---------------------------------------------------- | | messages | PermissionState | The current permission state for accessing messages. |

Type Aliases

PermissionState

'prompt' | 'prompt-with-rationale' | 'granted' | 'denied'