i am trying to send sms on button click, which would ask for permission from user to confirm and send message, when io build the code on my machine (windows 7) , it works properly, the message box is generated, however when the same code is tried on my clients system,(win 7) it just shows a creating buttons message at to of my app, and the message button is just not generated is there any setting i need to do to make it work here is my code
app.js
Emergency.addEventListener("click", function(e){ //alert(e.source.id + " fired a " + e.type + " event"); var eventWin = Ti.UI.createWindow({ url:'../Help_Submit.js', backgroundColor:'#FFF', fullscreen:false, navBarHidden:true, _parent:Ti.UI.currentWindow, modal:true }); eventWin.open(); });Help_Submit.js
var win = Titanium.UI.createWindow({ title: "Creating buttons", backgroundColor: "#FFFFFF", }); //alert('open Geo location'); // var db = Ti.Database.install('main_windows/HMS.sqlite', 'Emergency_Table'); // var rows = db.execute('SELECT * FROM Emergency_Table'); var msgbox = Titanium.UI.createAlertDialog({ title: 'Send SMS', message: 'Are you sure?', buttonNames: ['Yes', 'No'], cancel: 1 }); msgbox.addEventListener('click', function(e) { if (e.cancel === e.index || e.cancel === true) { return; } switch (e.index) { case 0: //Clicked YES Titanium.Geolocation.accuracy = Titanium.Geolocation.ACCURACY_BEST; Titanium.Geolocation.distanceFilter = 5; Titanium.Geolocation.getCurrentPosition(function(e) { if (e.error) { alert('HFL cannot get your current location'); return; } var longitude = e.coords.longitude; var latitude = e.coords.latitude; var altitude = e.coords.altitude; var heading = e.coords.heading; var accuracy = e.coords.accuracy; var speed = e.coords.speed; var timestamp = e.coords.timestamp; var altitudeAccuracy = e.coords.altitudeAccuracy; Ti.Geolocation.purpose = "Location will be used for app X"; Titanium.Geolocation.getCurrentPosition(function(e) { if (!e.success || e.error) { Ti.API.error(JSON.stringify(e.error)); alert('error ' + JSON.stringify(e.error)); return; } //alert('longitude' + e.coords.longitude); var reverseGeo = Titanium.UI.createLabel({ text: '', font: { fontSize: 11 }, color: '#444', top: 310, left: 10, height: 15, width: 300 }); win.add(reverseGeo); var displayreverseGeo; var countryInput; var cityInput; var streetInput;continued
Titanium.Geolocation.reverseGeocoder(latitude, longitude, function(evt) { if (evt.success) { var places = evt.places; if (places && places.length) { //reverseGeo.text = places[0].address; //countryInput = places[0].country; //zipInput.value = places[0].zipcode; //stateInput.value = places[0].state;// unable to get state value //cityInput = places[0].city; //street = places[0].street; //city = places[0].city; //country = places[0].country_code; //streetInput = places[0].street; //reverseGeo.value = places[0].address; displayreverseGeo = places[0].address; } else { reverseGeo.text = "No address found"; } Ti.API.debug("reverse geolocation result = " + JSON.stringify(evt)); } else { Ti.UI.createAlertDialog({ title: 'Reverse geo error', message: evt.error }).show(); //Ti.API.info("Code translation: " + translateErrorCode(e.code)); } //alert('reverseGeo.text' + reverseGeo.text); var smsMod = require('ti.android.sms'); Ti.API.info("module is => " + smsMod); smsMod.addEventListener('complete', function(e) { Ti.API.info('Result: ' + (e.success ? 'success' : 'failure') + ' msg: ' + e.resultMessage); var result = 'unexpected result...'; switch (e.result) { case smsMod.SENT: result = 'SENT'; break; case smsMod.DELIVERED: result = 'DELIVERED'; break; case smsMod.FAILED: result = 'FAILED'; break; case smsMod.CANCELLED: result = 'CANCELLED'; break; } //alert('Message sending result: ' + result); }); var db = Ti.Database.install('main_windows/HMS.sqlite', 'Emergency_Table'); var rows = db.execute('SELECT * FROM Emergency_Table'); while (rows.isValidRow()) { var recipient = rows.fieldByName('Mobile'); //alert(recipient); //+ ' longitude ' + e.coords.longitude + ' latitude ' + e.coords.latitude ' , ' + streetInput + var text = displayreverseGeo; var text2 = 'longitude ' + e.coords.longitude + ' latitude ' + e.coords.latitude ; smsMod.sendSMS(recipient, text); smsMod.sendSMS(recipient, text2); //alert(text); rows.next(); } //To reload row Ti.App.fireEvent('reload'); alert('message sent'); }); }); }); break; case 1: //Clicked YES break; default: break; }; }); //}; //rows.next(); //To reload row msgbox.show(); win.open();