How to improve GPS location Accuracy in Android

前端 未结 3 1474
攒了一身酷
攒了一身酷 2020-12-14 12:53

Hi im working on an app that uses GPS location. My testing devices are Nexus One and Htc Mytouch 3g Slide.

So does anyone know how to improve the GPS location accura

相关标签:
3条回答
  • 2020-12-14 13:21

    While it's true that since API 9 there are some new possibilities in terms of accuracy settings, what @dev mz said won't work. You can't use the new constants directly in criteria.setAccuracy. Instead you can use these new features like this:

            //All your normal criteria setup
            Criteria criteria = new Criteria();
            //Use FINE or COARSE (or NO_REQUIREMENT) here
            criteria.setAccuracy(Criteria.ACCURACY_FINE);
            criteria.setPowerRequirement(Criteria.POWER_LOW);
            criteria.setAltitudeRequired(true);
            criteria.setSpeedRequired(true);
            criteria.setCostAllowed(true);
            criteria.setBearingRequired(true);
    
            //API level 9 and up
            criteria.setHorizontalAccuracy(Criteria.ACCURACY_HIGH);
            criteria.setVerticalAccuracy(Criteria.ACCURACY_HIGH);
            criteria.setBearingAccuracy(Criteria.ACCURACY_LOW);
            criteria.setSpeedAccuracy(Criteria.ACCURACY_HIGH);
    

    As for your question, be aware that we are talking about Criteria for the incoming location updates. This won't actually improve the quality of the GPS data because that's device/hardware/network specific. It just acts like a filter for the incoming geolocations.

    0 讨论(0)
  • 2020-12-14 13:36

    see this post: Google Maps & apps with mapview have different current positions

    Are you talking about your own MapView witin your app or the Google Maps app? In your own map, use both network provider and gps provider to get the location. Gps only works outdoors under free sky and is more accurate, while a network provider works indoors as well but less accurate.

    Also read this: http://forum.sdx-developers.com/android-2-1-development/cdma-lockup-wifi-use-wireless-networks-and-gps!/msg22834/#msg22834

    0 讨论(0)
  • 2020-12-14 13:36

    Since API 9 you can use some constants for the setAccuracy method

    lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
    Criteria criteria = new Criteria();
    criteria.setAccuracy(Criteria.ACCURACY_HIGH);  
    lm.getBestProvider(criteria, true);
    

    ACCURACY_HIGH less than 100 meters
    ACCURACY_MEDIUM between 100 - 500 meters
    ACCURACY_LOW greater than 500 meters

    here are the details

    0 讨论(0)
提交回复
热议问题