Location manager does not detect location correctly even we are moving miles away in android
<p>In my application I have to fetch the current location. First it correctly fetches the location. But we are moving from the current location to some other location.  It shows the previous address. It is not updating the location. My code is:</p>

<pre><code>locManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE); 
locListener = new MyLocationListener();  
locManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,0,0,locListener);
location = locManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
if(location != null)                                
{
    latitude = location.getLatitude();
longitude = location.getLongitude();
}  


//My location listener is as follows

public void onLocationChanged(Location loc) {
    if (loc != null) {
        //Toast.makeText(this.getBaseContext(), 
        //"Location changed : Lat: " + loc.getLatitude() + 
        //" Lng: " + loc.getLongitude(), 
        //Toast.LENGTH_LONG).show();
        double lat = loc.getLatitude();
        double lon = loc.getLongitude();
    }
}

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>Please find the mistake and when i launch first time it is not working on second time itself it is working....so check this thing also.....</p>
