我想使用离子框架发送短信。我安装此插件:
cordova plugin add https://github.com/cordova-sms/cordova-sms-plugin.git
在javascript中:
document.addEventListener("deviceready", function() {
var options = {
replaceLineBreaks: false, // true to replace \n by a new line, false by default
android: {
intent: '' // send SMS with the native android SMS messaging
//intent: '' // send SMS without open any other app
//intent: 'INTENT' // send SMS inside a default SMS app
}
};
$cordovaSms
.send('+919915768727', 'This is some dummy text', options)
.then(function() {
alert('Success');
// Success! SMS was sent
}, function(error) {
alert('Error');
// An error occurred
});
});
邮件不发送。这会提醒错误。我不知道我错在哪里。
cordova version: 5.2.0
Ionic version: 1.6.4
答案 0 :(得分:-1)
你已将$ cordovaSMS的功能放在$ ionicPlatform函数中作为
$ionicPlatform.ready(function(){
$cordovaSms
.send($scope.form.number, $scope.form.message, options)
.then(function(result) {
console.log(result);
}, function(error) {
console.log(error);
})
})
我正在git hub上传一个演示项目,按照github的readme.md文件中的步骤进行操作 有任何疑问重播