I tried to get current user location on button press and show the address on screen.
I am using google fused location as follow
locationClient = LocationServices.getFusedLocationProviderClient(this)
locationRequest = LocationRequest()
locationRequest.priority = LocationRequest.PRIORITY_HIGH_ACCURACY
locationClient.requestLocationUpdates(locationRequest, callback, null)
and after I get the latitude and longitude, i resolve the address using geocoder as follow
addresses = geocoder.getFromLocation(
location.latitude,
location.longitude,
1)
The problem is that sometimes the address I get is not accurate. And if I minimize/close my apps, open Google Maps, and go back to my application again, the location that I get is accurate.
How do I fix these? Thanks