I'm beginner in android development . The problem is the code take several minutes to obtain user location so how i can fix this problem? please help me
LocationListener locationListener = new LocationListener() {
public void onLocationChanged(Location location) {
Toast.makeText(getBaseContext(),
"Location changed : Lat: " + location.getLatitude() +
" Lng: " + location .getLongitude(),
Toast.LENGTH_SHORT).show();
}
public void onStatusChanged(String provider, int status, Bundle extras) {}
public void onProviderEnabled(String provider) {}
public void onProviderDisabled(String provider) {}
};
lm.requestLocationUpdates(
LocationManager.GPS_PROVIDER,
0,
0,
locationListener);