@@ -32,40 +32,22 @@ Example Usage
3232HTML
3333
3434 <input name="" id="numberTxt" placeholder="Enter mobile number" value="" type="tel" />
35- <br/>
3635 <textarea name="" id="messageTxt" placeholder="Enter message"></textarea>
37- <br/>
38- <input id="btnDefaultSMS" type="button" value="Send SMS" />
36+ <input type="button" onclick="app.sendSms()" value="Send SMS" />
3937
4038Javascript
41- Note that the following code uses jquery.
4239
4340 var app = {
44- // Application Constructor
45- initialize: function() {
46- this.bindEvents();
47- },
48- // Bind Event Listeners
49- //
50- // Bind any events that are required on startup. Common events are:
51- // 'load', 'deviceready', 'offline', and 'online'.
52- bindEvents: function() {
53- document.addEventListener('deviceready', this.onDeviceReady, false);
54- },
55- // deviceready Event Handler
56- //
57- // The scope of 'this' is the event. In order to call the 'receivedEvent'
58- // function, we must explicity call 'app.receivedEvent(...);'
59- onDeviceReady: function() {
60- $("#btnDefaultSMS").click(function(){
61- alert("click");
62- var number = $("#numberTxt").val();
63- var message = $("#messageTxt").val();
64- var intent = "INTENT"; //leave empty for sending sms using default intent
65- var success = function () { alert('Message sent successfully'); };
66- var error = function (e) { alert('Message Failed:' + e); };
67- sms.send(number, message, intent, success, error);
68- });
41+ sendSms: function() {
42+ alert('click');
43+ var number = document.getElementById('numberTxt').value;
44+ var message = document.getElementById('messageTxt').value;
45+ alert(number);
46+ alert(message);
47+ var intent = 'INTENT'; //leave empty for sending sms using default intent
48+ var success = function () { alert('Message sent successfully'); };
49+ var error = function (e) { alert('Message Failed:' + e); };
50+ sms.send(number, message, intent, success, error);
6951 }
7052 };
7153
@@ -98,7 +80,7 @@ The problem is that you need to make sure that you set the target to android-19
9880 # Project target.
9981 target=android-19
10082
101- ###How can I send sms in my app without passing to native app like it can be done on Android?
83+ ###How can I send an sms in my iOS app without passing control to the native app like it can be done on Android?
10284
10385This isn't possible on iOS. It requires that you show the user the native sms composer, to be able to send an sms.
10486
0 commit comments