title: Android Geolocation Null in Titanium
body: <p>I can't get geolocations in the emulator or on a physical phone.</p>
  
  <p>I'm using Titanium SDK <strong>1.6.2</strong>, ADK <strong>2.2</strong>.</p>
  
  <p>I've followed the <a href="http://developer.appcelerator.com/question/106441/geolocation-cant-get-coords-on-android-emulator" rel="nofollow">approaches used here</a> to no avail.</p>
  
  <p>What am I missing? Thanks in advance.</p>
  
  <p>Error:</p>
  
  <p>Says that <code>e.coords</code> is null when doing this assignment. <code>f_lng = e.coords.longitude;</code></p>
  
  <p>Code:</p>
  
  <pre><code>function get_geolocation() {
  
      try {
  
          Ti.Geolocation.preferredProvider = 'gps';
          Titanium.Geolocation.accuracy = Titanium.Geolocation.ACCURACY_BEST;
          Titanium.Geolocation.distanceFilter = 10;
  
          if( Titanium.Geolocation.locationServicesEnabled === false ) {
              throw('Your device has GPS turned off. Please turn it on.');
          }
  
          var f_lat, f_lng;
  
          Titanium.Geolocation.getCurrentPosition(function(e) {
  
              if( ! e.success || e.error ) {
                  alert("Unable to get your location.");
              }
  
              f_lng = e.coords.longitude;
              f_lat = e.coords.latitude;
          });
  
          return {
              's_status': 'success',
              'f_lat': f_lat,
              'f_lng': f_lng
          };
  
      } catch( s_error ) {
  
          return {
              's_status': 'error',
              's_message': s_error
          };
      }
  }
  </code></pre>