Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including cordova-plugin-sms-receiver with all npm packages installed. Try it out:

cordova-plugin-sms-receiver lists no main file and has no index.js, so it can't be directly required. If this is a mistake, please let us know. It may however contain internal files that you can require manually:

// require("cordova-plugin-sms-receiver/[??]")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

cordova-plugin-sms-receiver v0.1.6

Cordova SMS Receiver Plugin

SMS Receiver plugin for Cordova

This Cordova Android plugin allows you to receive incoming SMS. You have the possibility to stop the message broadcasting and, thus, avoid the incoming message native popup.


cordova plugin add cordova-plugin-sms-receiver --save



Check if the SMS technology is supported by the device.

SmsReceiver.isSupported((supported) => {
  if (supported) {
    alert("SMS supported!")
  } else {
    alert("SMS not supported")
}), function() => {
  alert("Error while checking the SMS support")


Start the SMS receiver waiting for incoming message The success callback function will be called everytime a new message is received. The given parameter is the received message formatted such as: phoneNumber>message (Example: +32472345678>Hello World) The error callback is called if an error occurs.


SmsReceiver.startReception(({messageBody, originatingAddress}) => {
}, () => {
  alert("Error while receiving messages")


Stop the SMS receiver


SmsReceiver.stopReception(() => {
  alert("Correctly stopped")
}, () => {
  alert("Error while stopping the SMS receiver")

Aborting a broadcast

If you abort the broadcast using this plugin (see broadcast boolean variable in the name.ratson.cordova.sms_receiver.SmsReceiver), the SMS will not be broadcast to other applications like the native SMS app. So ... be careful !

A good way to manage this is to stop the SMS reception when the onPause event is fired and, when the onResume event is fired, restart the reception.

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free