On switch change event, I'm connecting to my server to synchronize the config. It looks like this:
Switch code:
var mySwitch = Ti.UI.createSwitch({ top: '22.5dp', right: '10dp', value: Ti.App.Properties.getBool("something"), width: '75dp', height: '25dp', titleOn: 'ON', titleOff: 'OFF' });Event code:
var value = mySwitch.getValue(); var setState; setState = (value ? '1' : '0'); var data = { uid: ..., stateVal: setState }; request.send(data);It basically gets current switch value and sends it to the server. Am I doing it wrong? It works on iOS simulator, but on Android it doesn't(Genymotion). What I mean is that on Android even if it shows the real switch value with alert(), though it sends always "0" in the request. What's going on? No idea...
PS: I've checked my API, if I use Android it gets "0" in the request, but it works great with iOS.