GithubHelp home page GithubHelp logo

rogerben / cordova-plugin-sms-receiver Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rehy/cordova-plugin-sms-receiver

0.0 1.0 0.0 28 KB

Cordova SMS Receiver Plugin

License: MIT License

Java 91.29% JavaScript 8.71%

cordova-plugin-sms-receiver's Introduction

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.

Install

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

Usage

isSupported

Check if the SMS technology is supported by the device.

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

startReception

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.

Example:

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

stopReception

Stop the SMS receiver

Example:

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.

cordova-plugin-sms-receiver's People

Contributors

ratson avatar pyo25 avatar sidchilling avatar bmihelac avatar liront avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.