ngCordova sms not working in my project

hi folks, im developing an sms application in which im try to use this plugin https://github.com/cordova-sms/cordova-sms-plugin.git with this code:

.controller(‘SmsCtrl’, function($ionicPlatform, $cordovaSms) {

    $ionicPlatform.ready(function() {

    $cordovaSms
        .send('1738567', 'SMS', options)
        .then(function() {
            // Success! SMS was sent
        }, function(error) {
            // An error occurred
        });

});

})`

and my html:

<button class="button button-block button-royal" onclick="send()">News Content</button>

i ve tried to make it send sms but not working but others plugins for device, social sharing and local notification are working perfectly, only sms remaining. pls help me. thanks

You may get help from here.
http://ngcordova.com/docs/plugins/socialSharing/

 $cordovaSocialSharing
.shareViaSMS(message, number)
.then(function(result) {
  // Success!
}, function(err) {
  // An error occurred. Show a message to the user
});

@motiurion i already used social sharing in my project but i still need to let ngcordova sms work

Check this:
http://ngcordova.com/docs/plugins/sms/

The code will like this:

.controller('ThisCtrl', function($cordovaSms) {

document.addEventListener(“deviceready”, function () {

$cordovaSms
  .send('1738567', 'SMS', options)
  .then(function() {
    // Success! SMS was sent
  }, function(error) {
    // An error occurred
  });

});

});

or

try it to add $cordovaSms in $ionicPlatform.ready function like:

$ionicPlatform.ready(function($cordovaSms) {

@motiurion thanks for your help but still not working, i dont know what im doing wrong

Maybe it’s a problem with Cordova 5.0, I use this plugin without trouve with 4.0

@jimibi can you pls show me the code u use for cordova sms plugin. thanks in advance

options = {
replaceLineBreaks: true, // 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
}
},
success = function () { alert(‘Message sent successfully’); },
error = function (e) { alert(‘Message Failed:’ + e); },

$window.sms.send(number, message, options, success, error);

thanks @jimibi i will try it and get to u later

Cordova Sms still not working, i think there is problem within my project or cordova 5.0 problem

Here it’s working.
Controller:

    .controller('SmsCtrl', function($scope, $cordovaSms) {
  $scope.sendSms = function(){
    $cordovaSms.send('YOUR_NUMBER_HERE', 'YOUR_MESSAGE_HERE').then(function(){
      alert("SMS enviado com sucesso");
    }, function(err){
      alert('Erro ao enviar SMS');
    });
  }
})

on template:

<input type="button" ng-click="sendSms()" value="Send SMS" />

Make sure to test in your mobile device, in my case I had to built for iOS with xcode to get working.

But take me a question, it is or is not working and sending SMS reading with Ionic?

My debug the device. I could not run sending sms. I need help too.
http://paste.ubuntu.com/12136016/

#Working tutorial

If anyone is interested I wrote an article on how to send an SMS message through Ionic application.

##Click here.

If you need more information feel free to ask, I’m always here.

I wrote it from the Android perspective. I tested everything on a real device and code us reusable.

No permissions are required, everything is configured automatically.

Few notes:

  • this ngCordova SMS plugin will not work on any Android version lower then 4.4.2.

  • You are required to use Whitelist plugin meta tag

  • Whitelist plugin at the same time required Cordova 5.0+ so make sure you have a latest one

Hi @Gajotres, I do not required to use Whitelist plugin meta tag.
Please, see

@tosystems That article is too old. And you DO require whitelist plugin when working with Cordova 4+ and sending SMS messages. Without it your application will throw an exception every time you try to send an SMS.

I tested everything yesterday, so this information is as fresh as it can be.

@Gajotres Oh, thank’s for advice me.

@Gajotres How do I wait for sending and display a message to the user or lock the submit button?

Sorry I don’t understand you, could you explain it a little bit better?

@Gajotres When i try setup intent = “” with error. But setup intent =“INTENT” with success.

cordova 6.4.0
Android 5+

Can you pls help me