Calling sms api phone using phonegap using javascript

I am new to phonegap. I have two text fields containing mobile n. and another text box contains some message according to the user entered. And one button to send SMS. I am using the code below.

  <script type="text/javascript">
    var ComposeSMS = function(){

    var contactno = document.test.phonenumber.value;
    var messagetext=document.test.message.value;

    window.location.href = "sms:contactno?body=messagetext";

    } 

<form name="test">
<input type="text" name="phonenumber"  /></br>
<input type="text" name="message"/></br>
<input onclick="ComposeSMS();" type="button" value="Compose SMS text with number and body" />
</form>

My problem is that I am not getting contact n. and messages in sms mobile body, please someone have an idea, and then reply as soon as possible. Thanks at Advance.

+5
source share
3 answers

Try

 window.location.href = "sms:"+contactno+"?body="+messagetext;
+9
source

You can specify a phone number, but apparently not the default text for your message. http://wiki.akosma.com/IPhone_URL_Schemes#SMS

iOS 4, MessageViewController, Message/SMS -

https://github.com/phonegap/phonegap-plugins/tree/master/iPhone/SMSComposer

+2

Try ...

window.location = "sms:contactno?body=messagetext";

instead.

0
source

All Articles