I want to send sms using ionic framework.I install this plugin:
cordova plugin add https://github.com/cordova-sms/cordova-sms-plugin.git
In 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
});
});
Message is not send.this will alert error.I dont know where I am wrong.
cordova version: 5.2.0
Ionic version: 1.6.4
you have place the function of $cordovaSMS in an $ionicPlatform function as
$ionicPlatform.ready(function(){
$cordovaSms
.send($scope.form.number, $scope.form.message, options)
.then(function(result) {
console.log(result);
}, function(error) {
console.log(error);
})
})
and I am uploading a demo project for you in git hub follow the steps in readme.md file of github
Having any queries replay back
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.