LocationManager locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE); | |
LocationListener locationListener = new LocationListener() { | |
public void onLocationChanged(Location location) { | |
// Called when a new location is found by the network location provider. | |
doSomethingWithLocation(location); | |
} | |
public void onStatusChanged(String provider, int status, Bundle extras) {} | |
public void onProviderEnabled(String provider) {} | |
public void onProviderDisabled(String provider) {} | |
}; | |
// Register the listener with the Location Manager to receive location updates | |
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, locationListener); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment