Note that there are some explanatory texts on larger screens.

plurals
  1. POCordova Android SMS plugin does not fire success or error callbacks
    text
    copied!<p>I am using the following plugin for Cordova with Android:</p> <p><a href="https://github.com/aharris88/phonegap-sms-plugin" rel="nofollow">https://github.com/aharris88/phonegap-sms-plugin</a></p> <p>I can validate that the SMS application opens and that a message is sent but the JS success or error callbacks are never fired.</p> <p>The code is implemented as per the plugin so I cannot think why this is not working to trigger the callbacks. I am using it with Cordova 2.9 although re-written for 3.0 the plugin is compatible with a few modifications as follows.</p> <p>In the sms JAVA file I had to update the dependencies like so:</p> <pre><code>import org.apache.cordova.api.CallbackContext; import org.apache.cordova.api.CordovaPlugin; import org.apache.cordova.api.PluginResult; </code></pre> <p>In the JS file i removed the following line:</p> <pre><code>module.exports = sms; </code></pre> <p>And just hook onto the sms global variable for now which is working.</p> <p>My JS to call the SMS function follows the same as in the example provided:</p> <pre><code> var number = '123456789'; var message = 'foo!'; var intent = "INTENT"; //leave empty for sending sms using default intent var success = function() { $.magnificPopup.close(); }; var error = function(e) { alert('Message Failed:' + e); }; sms.send(number, message, intent, success, error); </code></pre> <h1>UPDATE</h1> <p>If I remove the INTENT then the SMS is fired with the default SMS application automatically and things work as expected. </p> <p>However, is there a way to trigger a JS call back when the message is sent from the SMS application?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload