List of usage examples for android.location LocationManager getLastLocation
public Location getLastLocation()
From source file:com.google.android.dialer.provider.DialerProvider.java
private Location getLastLocation() { LocationManager locationManager = (LocationManager) getContext().getSystemService(Context.LOCATION_SERVICE); locationManager.requestSingleUpdate(new Criteria(), new LocationListener() { @Override//from w w w . ja va 2s .c o m public void onLocationChanged(Location location) { if (Log.isLoggable("DialerProvider", Log.VERBOSE)) { Log.v("DialerProvider", "onLocationChanged: " + location); } } @Override public void onProviderDisabled(String provider) { if (Log.isLoggable("DialerProvider", Log.VERBOSE)) { Log.v("DialerProvider", "onProviderDisabled: " + provider); } } @Override public void onProviderEnabled(String provider) { if (Log.isLoggable("DialerProvider", Log.VERBOSE)) { Log.v("DialerProvider", "onProviderEnabled: " + provider); } } @Override public void onStatusChanged(String provider, int status, Bundle extras) { if (Log.isLoggable("DialerProvider", Log.VERBOSE)) { Log.v("DialerProvider", "onStatusChanged: " + provider + ", " + status + ", " + extras); } } }, DialerProvider.mLooper); return locationManager.getLastLocation(); }