My app use Google Play service API to get the user location and check if the device is inside or outside a particular area of 50 mt of radius. The app use PRIORITY_HIGH_ACCURACY and a Interval of 1 minute. So I create GoogleApiClient:
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(LocationServices.API)
.build();
mGoogleApiClient.connect();
In the onConnected callback:
mLocationRequest = new LocationRequest();
mLocationRequest.setInterval(60000);
mLocationRequest.setFastestInterval(10000);
mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
and
MyLocationListener.FusedLocationApi.requestLocationUpdates(mGoogleApiClient, mLocationRequest, mLocationListener);
My app also filter locations based on accuracy (if accuracy > 200 mt I discard it) and time (if it is too old I discard it).
The app works fine except in some particular areas where sometimes it returns wrong locations update about 500 meters from the real location, and those wrong locations are always near the same place, some step away from a Cell Tower.
In those areas I get a combination of wrong and correct locations and my app think that the device is sometimes inside and sometimes outside the area of interest.
When I get a location update I wait for other 3 in a row to confirm the position. Also I filter location if exactly the same as the previous. This means that when I m getting those errors I'm receiving 4 wrong locations in a row each one slightly different from the others.
Is there a way to prevent this behavior? Can this be caused by the Cell Tower?