Code Monkey home page Code Monkey logo

cordova-sms-plugin's Introduction

Sms Custom Cordova Plugin:

This plugin allows you to send SMS message to a specific phone number for Android, iOS and Windows Platform 8. Here is an example below:

var messageInfo = {
	phoneNumber: "xxxxxxxxxx",
	textMessage: "This is a test message"
};

sms.sendMessage(messageInfo, function(message) {
	console.log("success: " + message);
}, function(error) {
	console.log("code: " + error.code + ", message: " + error.message);
});

As you notice you just need to call sms.sendMessage(messageInfo, successCallback, failureCallback):

  • messageInfo is a JSON object which contains phoneNumber and textMessage attributes.
  • sucessCallback is a callback function which will be called if the send SMS operation succeeds.
  • errorCallback is a callback function which will be called if the send SMS operation fails.

Installing the plugin

In order to install the plugin you can simply use the following Cordova CLI command:

cordova plugin add https://github.com/hazems/cordova-sms-plugin.git

or

cordova plugin add com.jsmobile.plugins.sms

Important Note

For iOS and Windows Phone platforms, it is not possible to send SMS directly without opening the default device SMS application. This means that the API will only open and track the SMS application events (cancel, successful sending, un-successful sending, ...etc) in iOS platform. For Windows Phone 8, the plugin will only open the SMS application without tracking its events because tracking SMS application events is not currently applicable in Windows 8 platform.

Test Client

You can reach the test client of this plugin here: https://github.com/hazems/cordova-sms-plugin-test/

Used Resources

Special Thanks to appcoda.com for helping me in implementing the iOS part of this plugin:

http://www.appcoda.com/ios-programming-send-sms-text-message/

Licence

It is Apache License, Version 2.0. Feel free to fork the project and send pull requests if you have any.

cordova-sms-plugin's People

Contributors

dmcg avatar hazems avatar leecrossley avatar

Watchers

 avatar  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.