-
-
Save SlavaFir/20298c6eb3668d6c3c8ab5f691e1f3d9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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