I am running my app, but afrer sometimes, every now and then I get the error "Can not get server response, even though the internet is working.
Below is the code to check the internet connection which I have.
if (Titanium.Network.networkType != Titanium.Network.NETWORK_NONE) { Alloy.Globals.showIndicator(Alloy.Globals.mainWindow); var xhr = Titanium.Network.createHTTPClient({ onload : function(e) { var entries = JSON.parse(this.responseText).entries; if (args.fromLog == "Yes") { Alloy.Globals.db = Ti.Database.open('DB'); Alloy.Globals.db.execute("DELETE FROM LogsEntries WHERE logid= '" + location_id + "'"); Alloy.Globals.db.execute('INSERT INTO LogsEntries (logentry,logid) VALUES (?,?)', JSON.stringify(entries), location_id); Alloy.Globals.db.close(); } else { Alloy.Globals.db = Ti.Database.open('DB'); Alloy.Globals.db.execute("DELETE FROM LocationsEntries WHERE locationid= '" + location_id + "'"); Alloy.Globals.db.execute('INSERT INTO LocationsEntries (locationentry,locationid) VALUES (?,?)', JSON.stringify(entries), location_id); Alloy.Globals.db.close(); } getEntriesFromDB(args, location_id); Alloy.Globals.hideIndicator(); }, onerror : function(e) { Alloy.Globals.hideIndicator(); alert("Can not get server response"); } });Please help.