最近作的项目须要有提醒用户的功能,就是能够调用手机的发送短信功能android
①、添加插件$cordovaSMSgit
cordova plugin add https://github.com/cordova-sms/cordova-sms-plugin.git
②、在controller中添加依赖github
//发短信 $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) .then(function() { // Success! SMS was sent CommonJs.AlertPopup("发送短信成功"); }, function(error) { // An error occurred }); };
https://github.com/cordova-sms/cordova-sms-plugin 官网地址和介绍。
app