Sending a SMS with the sms-cordova-plugin plugin on Android: “Invalid Action” Error


#1

Hello.
I want to send an SMS on Android mobile from an application developed in Cordova 5.3.1 on Windows. I use more ng-cordova.

Here are the contents of my config.xml:

<widget ...>
      <name>Appli vers 1.1</name>
      <description>
          Application APP
      </description>
      <author email="contact@tikdem.com" href="http://www.tikdem.com">
            TIKDEM SARL
      </author>
     <content src="index.html" />
      <access origin="*" />
</widget>

I put the following line code in index.html:

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

And in the controller:

App.controller('HomeCtrl', function ($scope, $http, $compile,  $cordovaGeolocation,$timeout,$cordovaDialogs,$filter, $q, debugMode, $cordovaSms) {
 document.addEventListener("deviceready", function() { $scope.sendSMS = function() {
 var number = "00243998183333"; 
 var message = "MESSAGE SMS";
 //CONFIGURATION
var options = {
    replaceLineBreaks: false,
    android: {
        //intent: 'INTENT'  
        intent: '' 
   }
 };
var success = function () { alert('Message sent successfully'); };
var error = function (e) { alert('Message Failed :' + e); };
sms.send(number, message, options, success, error);}})

After generating the APK file and install it on my Android phone, the Send SMS button always generates the error “invalid action”.

Could someone guide me to understand where the error comes from? Where can I find examples of complete codes to send an SMS from cordova on Android?