Created
August 24, 2014 17:15
-
-
Save j-onathan/1492fe05d45224ca45ad to your computer and use it in GitHub Desktop.
Android Code Example: Getting Continuous Location Updates (from https://www.codota.com/android/scenarios/52fcbdd6da0a6fdfa4630372/getting-continuous-location-updates?tag=dragonfly)
This file contains hidden or 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
private void ifGPSregisterOneShotNetworkUpdate() { | |
String bestEnabledProvider = locationManager.getBestProvider(criteria, true); | |
if (bestEnabledProvider != null && LocationManager.GPS_PROVIDER.equals(bestEnabledProvider)) { | |
locationManager.removeUpdates(oneShotNetworkLocationListener); | |
if (isNetworkProviderEnabled()) { | |
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, oneShotNetworkLocationListener); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment