hi,
I am initiating services in app.js, I want to stop the services in active window by using switch. how to do this?
my code is
Ti.App.addEventListener('pause', function(e) { // register a background service. this JS will run when the app is backgrounded //if switch is ON start the back ground services, when app is pause if (Ti.App.Properties.getString('getLocation') == 'YES') { if(service === null) { service = Ti.App.iOS.registerBackgroundService({ url : '/mainWindows/bg.js' }); } // else // { // service.stop(); // service.unregister(); // } } else { timer = Ti.App.Properties.getString('timerValue'); clearInterval(timer); service.stop(); service.unregister(); } });bg.js is empty file, In other .js file called geoTrace.js I have a switch, if I off the switch the services could be off.
Please do help for this thanks in advance.