Hello,
I already implement background service for my app. I am using it for getting user current location by using location services.
I will explain the way i implement this - "XYZ.js" - Screen where user distance display. Following code is added to set register background service -
var iService = Ti.App.iOS.registerBackgroundService({ url : 'BackgroundService.js' });once app go to background, background service start and collect user locations. When app come is at foreground i fired following event -
Ti.App.fireEvent('stopBackgroundService');In "BackgroundService.js" - there is listener as -
Ti.App.addEventListener('stopBackgroundService',function(){ Ti.App.currentService.stop(); });But after finishing this all location base work, when i move to other screen and move app to background location services start again. Which affects device battary.
Any suggestions? Thanks in advance.