title: Android GPS app not working on Emulator
body: <p>I have unsuccessfully attempted to get GPS Location to work for my app under Android. I would like to know what I might be doing wrong. I have so far tried the following methods:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/6068614/get-gps-location-instantly-via-android-app">Get GPS Location instantly via Android app</a>  </li>
  <li><a href="http://www.javacodegeeks.com/2010/09/android-location-based-services.html" rel="nofollow noreferrer">http://www.javacodegeeks.com/2010/09/android-location-based-services.html</a></li>
  <li><a href="http://about-android.blogspot.de/2010/04/find-current-location-in-android-gps.html" rel="nofollow noreferrer">http://about-android.blogspot.de/2010/04/find-current-location-in-android-gps.html</a> </li>
  </ul>
  
  <p>as well as many others, but all in vain.</p>
  
  <p>Considering that all the solutions above worked for some or the other person, I will use this one to debug:</p>
  
  <pre><code>package my.namespace;
  
  import android.app.Activity;
  import android.content.Context;
  import android.location.Location;
  import android.location.LocationListener;
  import android.location.LocationManager;
  import android.os.Bundle;
  import android.util.Log;
  import android.widget.Toast;
  
  public class HomeActivity extends Activity {
      @Override
      public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
  
      LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
      LocationListener ll = new mylocationlistener();
      lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, ll);
      }
  
      private class mylocationlistener implements LocationListener {
      public void onLocationChanged(Location location) {
          if (location != null) {
          Log.d("LOCATION CHANGED", location.getLatitude() + "");
          Log.d("LOCATION CHANGED", location.getLongitude() + "");
          Toast.makeText(HomeActivity.this,
              location.getLatitude() + "" + location.getLongitude(),
              Toast.LENGTH_LONG).show();
          }
      }
      public void onProviderDisabled(String provider) {
      }
      public void onProviderEnabled(String provider) {
      }
      public void onStatusChanged(String provider, int status, Bundle extras) {
      }
      }
  }
  </code></pre>
  
  <p>There were <code>@override</code> annotations for the 3 methods <code>onProviderDisabled</code>, <code>onProviderEnabled</code> and <code>onStatusChanged</code>. I had to remove them because Eclipse gave an error that these methods are not overriding a superclass.</p>
  
  <p>I have added the permissions in the manifest file (<code>ACCESS_FINE_LOCATION</code>, <code>ACCESS_MOCK_LOCATION</code>, <code>ACCESS_COARSE_LOCATION</code> and <code>INTERNET</code>).</p>
  
  <p>Does anyone have an idea what I might be doing wrong?</p>
  
  <p>Edit:
  running on Emulator (Android 2.2 API 8)</p>