Hi! I have a timer in tab. This timer run every 10 seconds.
/* * Start the scanning of device */ function startScanningForDevice() { if(timer == null) { timer = setInterval(function() { verifyNeighborhood(); }, (10 * 1000)); //Ti.API.info("Detection started"); } } /* * Stop the scanning of device */ function stopScanningForDevice() { if(ic.app.isReceiveNotification) { //Ti.API.info("Detection stoped"); clearInterval(timer); timer = null; contacts = new Array(); bindTableView(); } } function verifyNeighborhood() { /*var userInfo = Ti.App.Properties.getString("UserInfo"); if(userInfo != null) { var user = JSON.parse(userInfo);*/ //Ti.API.info("Looking for: " + ic.app.API_URL + "detection.php?km=" + ic.app.distanceFilter + "&gpsx=" + ic.app.x + "&gpsy=" + ic.app.y + "&uid=" + user.UserID ); showIndicator(); var request = Ti.Network.createHTTPClient(); request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); request.open("GET", ic.app.API_URL + "detection.php", false); request.send({ km: ic.app.distanceFilter, gpsx: ic.app.x, gpsy: ic.app.y, uid: ic.app.userID });//user.UserID }); //ic.app.distanceFilter var result = request.responseText; //request.onload = function(e) { //Ti.API.info("Answer: " + this.responseText); verifyNeighborhoodComplete(result);//this.responseText); /*}; request.onerror = function(e) { verifyNeighborhoodError(e.error); };*/ //} }In my app.js I have a pause event:
Titanium.App.addEventListener('pause',function(e) { if(ic.app.userID != 0) { var request = Ti.Network.createHTTPClient(); request.open("GET", ic.app.API_URL + "removeDevice.php", false); request.send({ uid: ic.app.userID }); } });When I'm in the tab page where the timer is running, the pause event don't fire up.
If I move to another tab, it fire ok.
Anyone knows why???
Thank you.
1 Answer
Hi, finally realize that this is a limitation of AppCelerator.
Your Answer
This question has been locked and cannot accept new answers.