Reputation: 551
why my location is little bit not accurate and some times far from my real location, my real location in red sign and some times my location detect in green sign it's so far from my location
how do i can fix that?
this my code for detect my location
@Override
public void onMapReady(GoogleMap googleMap) {
this.googleMap = googleMap;
this.googleMap.setMapType(GoogleMap.MAP_TYPE_TERRAIN);
GoogleMapOptions option = new GoogleMapOptions();
option.compassEnabled(true);
this.googleMap.setTrafficEnabled(true);
googleMap.setMyLocationEnabled(true);
googleMap.setOnMyLocationChangeListener(myLocationChangeListener);
}
private OnMyLocationChangeListener myLocationChangeListener = new OnMyLocationChangeListener() {
@Override
public void onMyLocationChange(Location location) {
if(awal) {
awal=false;
googleMap.moveCamera(CameraUpdateFactory.newLatLng(new LatLng(location.getLatitude(), location.getLongitude())));
googleMap.animateCamera(CameraUpdateFactory.zoomTo(13));
}
}
};
Upvotes: 0
Views: 198
Reputation: 13313
Sometimes
In android accurate location is 68% confidence.
if you draw a circle centered at this location's latitude and longitude, and with a radius equal to the accuracy, then there is a 68% probability that the true location is inside the circle.
In statistical terms, it is assumed that location errors are random with a normal distribution, so the 68% confidence circle represents one standard deviation. Note that in practice, location errors do not always follow such a simple distribution.
This accuracy estimation is only concerned with horizontal accuracy, and does not indicate the accuracy of bearing, velocity or altitude if those are included in this Location.
If this location does not have an accuracy, then 0.0 is returned. All locations generated by the LocationManager include an accuracy
more details Refer Location
Upvotes: 1