user4728148
user4728148

Reputation:

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
}
}

Upvotes: 0

Views: 942

Answers (2)

Nagarjun
Nagarjun

Reputation: 6877

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

Upvotes: 0

Shibin S
Shibin S

Reputation: 149

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.

Upvotes: 2

Related Questions