PoolHallJunkie
PoolHallJunkie

Reputation: 1363

Determine if CLLocation output was a product of GPS, WiFi or Cellular checks

My understanding is that CoreLocation is a black box that when user gives permissions it outputs a location approximation.

Is there any way to check the location object to see if WiFi was used instead of the GPS ? Or similarly the Cellular data ?

One way that I had in mind was classifying the accuracy of the output assuming it would be GPS -> WiFi -> Cellular. For example:

func inferLocationSource(location: CLLocation) -> String {
    let accuracy = location.horizontalAccuracy

    switch accuracy {
    case 0..<10:
        return "GPS"
    case 10..<50:
        return "Wi-Fi"
    case 50...:
        return "Cellular"
    default:
        return "Unknown"
    }
}

Are the accuracy or distance filters when initiating the manager affect the CoreLocation black box ?

Upvotes: 0

Views: 46

Answers (0)

Related Questions