Change provider is accuracy is too low
This commit is contained in:
@@ -104,7 +104,14 @@ class MainActivity : ComponentActivity() {
|
||||
override fun onLocationResult(locationResult: LocationResult) {
|
||||
locationResult ?: return
|
||||
for (location in locationResult.locations){
|
||||
|
||||
if(location.accuracy < 60){
|
||||
if(location.provider == LocationManager.NETWORK_PROVIDER){
|
||||
location.provider = LocationManager.GPS_PROVIDER
|
||||
}else{
|
||||
location.provider = LocationManager.NETWORK_PROVIDER
|
||||
}
|
||||
break
|
||||
}
|
||||
latitude = location.latitude
|
||||
longitude = location.longitude
|
||||
mapController.animateTo(GeoPoint(latitude, longitude))
|
||||
|
||||
Reference in New Issue
Block a user