How to track if location services is enabled or not enabled? titanium <p>I am able to turn it off.</p> <p>code:</p> <pre><code>//get current Location // Titanium.Geolocation.accuracy = Titanium.Geolocation.ACCURACY_BEST; Titanium.Geolocation.distanceFilter = .25; var overlays = require('overlays'); //check if gps is enabled exports.checkGPS = function(windowCur) { Ti.Geolocation.accuracy = Titanium.Geolocation.ACCURACY_BEST; // make the API call var wrapperW = overlays.wrapperOverlay(windowCur); Ti.Geolocation.getCurrentPosition(function(e) { // do this stuff when you have a position, OR an error if (e.error) { Ti.API.error('geo - current position' + e.error); //put overlay on overlays.GPSError(windowCur); return; }else{ //alert(JSON.stringify(windowCur)); wrapperW.hide(); } }); }; </code></pre> <p>This works fine at getting whether the user has turned on or off their location services. An overlay is put on the screen informing the user they need to turn it on, if they have turned it off.</p> <p>However the problem is after the user has set it, and then goes into settings -> location services and enabled it, I am unable to take the overlay off as I have know way off tracking in real time if it has been turned on or off.</p> <p>Does anyone know how this can be achieved, cheers.</p> <p>UPDATE:</p> <p>This did the trick</p> <pre><code>var wrapperW = null; Titanium.Geolocation.addEventListener('location', function(e) { if (e.error) { //put overlay on wrapperW = overlays.GPSError($.win); } else { //keep updating Ti.API.info(e.coords); if (wrapperW != null) { wrapperW.hide(); } } }); </code></pre>