The battery drains quickly, how to fix it?
Platform: iOS
My code in background process:
function checkLocation() { if (Ti.Geolocation.locationServicesEnabled) { Ti.Geolocation.accuracy = Ti.Geolocation.ACCURACY_BEST; Ti.Geolocation.preferredProvider = Ti.Geolocation.PROVIDER_GPS; Ti.Geolocation.getCurrentPosition(function(e) { Ti.API.info('Device Background Tracking Ping'); if (!e.success || e.error) { Ti.API.info('Device Tracking Error: ' + e.error); } else { var timestamp = parseFloat(e.coords.timestamp); if (timestamp - deviceOldTimestamp > 60000) { Ti.API.info('Device Tracking Timestamp'); exports.sendLocation(e.coords, active_session); deviceOldTimestamp = timestamp; } } }); } else { Ti.API.info('Geolocation Disabled'); return; } } if (deviceInterval) { clearInterval(deviceInterval); } deviceInterval = setInterval(checkLocation, 60000);