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

react-native-background-sms

v1.0.0

Published

Send SMS in background on Android, compose UI on iOS. No user interaction needed on Android.

Downloads

19

Readme

react-native-background-sms

Send SMS in the background on Android — no user interaction required. On iOS, opens a pre-filled compose UI (Apple restriction).

Why?

Most React Native SMS libraries only open the device's SMS app, requiring the user to manually tap "Send". This library sends SMS automatically in the background on Android using the native SmsManager API. Perfect for safety apps, alert systems, and emergency notifiers.

| Feature | Android | iOS | |---------|---------|-----| | Sends without UI | Yes | No (Apple restriction) | | User interaction needed | None | Must tap Send | | Multiple recipients | One SMS per recipient | Single compose UI | | Long message support | Auto-split (multipart) | Handled by compose UI | | Delivery tracking | BroadcastReceiver | Delegate callback |

Installation

npm install react-native-background-sms

iOS

cd ios && pod install

Android

Add the SMS permission to your android/app/src/main/AndroidManifest.xml:

<uses-permission android:name="android.permission.SEND_SMS" />

You must request this permission at runtime before calling sendSms(). Use a library like react-native-permissions or Android's built-in permission API.

API

canSendSms()

Check if the device can send SMS.

import { canSendSms } from 'react-native-background-sms';

const { available, reason } = await canSendSms();

if (!available) {
  console.log('Cannot send SMS:', reason);
}

Returns: Promise<CanSendSmsResult>

interface CanSendSmsResult {
  available: boolean;
  reason?: string;  // Only present when available is false
}

sendSms(options)

Send SMS to one or more recipients.

import { sendSms } from 'react-native-background-sms';

const result = await sendSms({
  phoneNumbers: ['+1234567890'],
  message: 'Hello from react-native-background-sms!',
});

if (result.status === 'sent') {
  console.log('SMS sent successfully');
} else if (result.status === 'failed') {
  console.log('SMS failed:', result.error);
} else if (result.status === 'cancelled') {
  // iOS only — user dismissed the compose UI
  console.log('User cancelled');
} else if (result.status === 'unavailable') {
  console.log('SMS not available:', result.reason);
}

Returns: Promise<SendSmsResult>

interface SendSmsOptions {
  phoneNumbers: string[];  // E.164 format recommended (e.g., '+1234567890')
  message: string;
}

interface SendSmsResult {
  status: 'sent' | 'failed' | 'cancelled' | 'unavailable';
  error?: string;   // Present when status is 'failed'
  reason?: string;  // Present when status is 'unavailable'
}

Platform Behavior

Android

  • SMS is sent silently in the background using Android's SmsManager API
  • Each recipient receives an individual SMS
  • Long messages (>160 chars) are automatically split into multipart SMS
  • A BroadcastReceiver tracks delivery with a 30-second timeout
  • If sending to multiple recipients and one fails, sending stops — already-sent messages are not rolled back
  • Requires SEND_SMS runtime permission

iOS

  • Opens the native MFMessageComposeViewController with pre-filled recipients and message
  • The user must tap Send — Apple does not allow programmatic SMS sending
  • All recipients appear in a single compose view
  • If the app is in the background when sendSms is called, the compose UI appears when the app returns to foreground

Error Codes

| Code | Platform | Meaning | |------|----------|---------| | SMS_UNAVAILABLE | Both | Device cannot send SMS (no telephony hardware) | | SMS_NO_SERVICE | Android | No cellular service | | SMS_RADIO_OFF | Android | Airplane mode or radio off | | SMS_TIMEOUT | Android | No delivery confirmation within 30 seconds | | SMS_FAILED | Both | General send failure | | SMS_ERROR | Both | Unexpected error |

Requirements

  • React Native >= 0.70
  • Android minSdk 24 (Android 7.0)
  • iOS 13.0+

License

MIT