The question is how to organize automatic determination of the location of the device with high accuracy. It is clear that we catch the change of coordinates in onLocationChanged, but how do you know that the coordinates are exact and do not require further clarification? Here is a method
LocationServices.FusedLocationApi.requestLocationUpdates( mGoogleApiClient, mLocationRequest, this);
And such a LocationRequest
protected void createLocationRequest() { mLocationRequest = new LocationRequest(); mLocationRequest.setInterval(10 * 1000); mLocationRequest.setFastestInterval(5 * 1000); mLocationRequest.setNumUpdates(3);//как пример mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY); }
With such a LocationRequest, the device will insert the GPS or GLONASS and will position itself. The essence of the question is when the first time onLocationChanged works, it’s not a fact that the coordinates will be accurate, for example, the next update may be a clarification, just like the third coordinate change may be less accurate than the second.