title: Location is null on device
body: <p>I am testing my app on a real device and getting a <code>null</code> location when the GPS is on. When I test on the emulator with dummy coordinates it works fine. What is wrong?</p>
  
  <pre><code>locationManager = (LocationManager) context.getSystemService(context.LOCATION_SERVICE);
  listener = new MyLocationListener();
  viaGps = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);
  viaNetwork = locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER);
  if (!viaGps &amp;&amp; !viaNetwork) {
      tracking = false;
  } else {
      if (viaGps) {
          Log.d("", "gps is on");
          locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, listener);
          location = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
      }else if (viaNetwork) {
          Log.d("", "network is on");
          locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, listener);
          location = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
      }
      if (location == null) {
          Log.d("", "location not fouond");
      }
  </code></pre>