Dhananjay Kumar
Dhananjay Kumar

Reputation: 51

Sending SMS from the app without opening the native sms app on Android using PhoneGap

In my application there is a button. On click event of that button I want to send SMS. I am using PhoneGap. I am sending SMS using URL scheme as following

window.location.href = "sms:" + numberstosend + "?body=" + messagetosend + "    I am at   "  + currentlocation; 

This is working fine. However this opens the native SMS application with preconfigured numbers and message body. Now again user has to click on send button of native sms app to send the SMS.

My requirement is that I want to send SMS without opening the native sms application on Android. User click on the button and message should be sent.

Is it possible using PhoneGap ?

Upvotes: 1

Views: 2028

Answers (1)

Pierre-Yves O.
Pierre-Yves O.

Reputation: 578

You should use the native SMS Manager through a Phonegap plugin.

An up-to-date plugin: https://github.com/Pyo25/phonegap-sms-sending-plugin You will find examples on the Github page.

Upvotes: 1

Related Questions