Unbelievably inaccurate GPS points. What is the reason?

后端 未结 7 1860
广开言路
广开言路 2021-01-01 18:24

I have developed an application for Android, for storing user\'s GPS location.

One of my customers gave me his device and I noticed that sometimes the accuracy of t

7条回答
  •  孤城傲影
    2021-01-01 18:50

    The most important take away I hope to leave you with is take time to understand your accuracy requirements and your user’s basic geographic behavior patterns. I’ve tried to liberally sprinkle example use cases to help illustrate some of the concepts.

    This is accomplished using the overloaded LocationManager.requestLocationUpdates() method. These properties adjust how aggressively the device will request location updates by minimum time elapsed and minimum distance traveled.

    locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,0,0,listener);
    

    This method will resolve your issue a very basic set of technical requirements for dynamically changing requestLocationUpdates() settings:

    public void onLocationChanged(Location location) {
         if(location.getAccuracy() < 100.0 && location.getSpeed() < 6.95){
              //Do something
         }
         else{
              //Continue listening for a more accurate location
         }
    }
       
    
    • Start application using minTime= 0 and minDistance = 0. Use an aggressive setting to get accurate location as quickly as possible.

    • Once accuracy is less than 50 meters and speed less than 45 mph set minTime = 5000 and minDistance = 25.

    • Speed equals 0 for greater than 1 hour. Shut off location listeners and notify user.

    • Battery gets low. Shut off location listeners and notify user.

提交回复
热议问题