Created
September 21, 2019 09:43
-
-
Save DawnImpulse/3802834d6d5c32d5d825202d6af6edd0 to your computer and use it in GitHub Desktop.
Get fine location android
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 = getSystemService(Context.LOCATION_SERVICE) as LocationManager | |
if (locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) { | |
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 5000, 10f, LocationListenerCallback) | |
} else if (F.isConnected(this)) { | |
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 5000, 10f, LocationListenerCallback) | |
} else | |
toast("kindly enable either GPS / Internet to get location") | |
// for opening gps settings activity | |
startActivity(Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment