简体   繁体   中英

How do i send a SMS using phonegap without opening the native app?

I am making an SMS app using HTML,CSS, and JAVASCRIPT on intel xdk. I have tried quite a few SMS phonegap plugins, but all open the native SMS app and the user has to click send again.

Is there anyway i can send the SMS using the above coding languages but without opening the default SMS app?

EDIT : Surprisingly, just moments after posting this question. I found this CORDOVA SMS PLUGIN I'm yet to check if it works. Meanwhile, is there any other method too?

I tried that plugin ( https://github.com/hazems/cordova-sms-plugin ) and it worked for me. I can't endorse it, but I was able to send a text message without going into the SMS app, though it does show the message in my history of messages in the SMS app.

I just included the plugin as a third party plugin on the projects page and used this code (with a valid number in place of the Xs) :

var mymsg = {
    phoneNumber: "XXXXXXXXXX",
    textMessage: "Testing"
}

if (typeof sms === 'undefined' || typeof sms.sendMessage !== 'function') {
    alert("No plugin");
}
sms.sendMessage(mymsg, function(message) {
    console.log("success: " + message);
    alert("Sent");
}, function(error) {
    console.log("code: " + error.code + ", message: " + error.message);
    alert("Error sending");
});

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM