1. Requirements Description
Recently done projects need to have the ability to remind users that can call the phone to send SMS function
2. Preparation
①, add plugin $cordovasms
Cordova Plugin Add Https://github.com/cordova-sms/cordova-sms-plugin.git
②, adding dependencies to the controller
3. Code implementation
Texting $scope.sendmessage=function () { //configuration var options = { replacelinebreaks: false, // true to replace \n by a new line, false by default android: { intent: ' Intent ' // send SMS with the native android sms messaging //intent: ' // send SMS without open any other app } }; $cordovaSms .send (' 18654332789 ', ' sms content ', options) &nBSP;. Then (function () { // success! SMS was sent Commonjs.alertpopup ("Send SMS Success"); }, function (Error) { // an error occurred });};
4, the attention point
It seems that a lot of things need to go to the official website to see the original code and documents, Ng-cordova documents are not complete, no introduction option How to configure, you can find some open source other plug-ins from GitHub. How to find other open source plug-ins to introduce
Https://github.com/cordova-sms/cordova-sms-plugin website address and introduction.
Ionic Series--Send SMS