Unable to get GPS coordinates on Android
<p>I am trying to obtain the GPS coordinates with the following code:</p>

<pre><code>public class conTest extends Activity implements LocationListener{
TextView headerText;
BufferedReader in = null;
private LocationManager lm;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    lm = (LocationManager)getSystemService(Context.LOCATION_SERVICE);    
    lm.requestLocationUpdates(LocationManager.GPS_PROVIDER,0,0,this);
}

public void onLocationChanged(Location location) {
    if (location != null) {
        Toast.makeText(getApplicationContext(),"Location changed : Lat: " + location.getLatitude() + " Lng: " + location.getLongitude(),Toast.LENGTH_SHORT).show();
    }
}

public void onProviderDisabled(String provider) {
    // TODO Auto-generated method stub

}

public void onProviderEnabled(String provider) {
    // TODO Auto-generated method stub

}

    public void onStatusChanged(String provider, int status, Bundle extras) {
        // TODO Auto-generated method stub

    }
}
</code></pre>

<p>Problem is that when i try to send gps coordinates using DDMS, a toast will appear and say that the location is 0.0,0.0. This is not what i entered. When i try to send a new and different location, nothing happens.<br>
I have allowed mock locations on the emulator and the LOCATION_FINE/INTERNET permissions has been set.<br>
I am developing in Eclipse 3.5 using Api 2.1</p>

<p>Help! What have I done wrong?</p>
