简体   繁体   中英

How to track GPS location for charge on iOS device like Uber?

My team want to make an iOS app like Uber, which can track GPS location for charge. But according to my experiment and real-test, the GPS location point is not always accurate, there is some deviation sometimes. (the accuracy is low sometimes). So what cane be done to do like Uber? thanks!

_locationManager.activityType = CLActivityTypeAutomotiveNavigation;
_locationManager.desiredAccuracy = kCLLocationAccuracyBestForNavigation;
_locationManager.distanceFilter = kCLDistanceFilterNone;

- (void)locationManager:(CLLocationManager *)manager  didUpdateLocations:(NSArray<CLLocation *> *)locations
{
CLLocation *location = [locations lastObject];

if (location)
{
    //success, but there is some deviation sometimes.the accuracy is low sometimes
}
else
{
    //error
}
}

GPS accuracy depends on location. If you are moving in a tunnel or parking lot, GPS accuracy will be extremely low. So you need to check accuracy before taking signals for calculation for eg

if (location.horizontalAccuracy < 63) {
// GOOD SIGNAL
}

You can design some filter algorithm to filter out signals depending upon your need.

You can customize your accuracy.

CLLocation -horizontalAccuracy and -verticalAccuracy will do that.

You can see people posted answers already.

https://stackoverflow.com/a/17337483/3840428

https://stackoverflow.com/a/24876562/3840428

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM