问题
I am using CLLocationManager to get location updates in my app. Is there a way to determine what the GeoLocation method was? E.g. GPS, Triangulation, IP (Network).
回答1:
Not really. You can take a look at the horizontalAccuracy
of a CLLocation object and hazard a guess based on its value, though:
- < 25 meters: probably GPS
- < 200 meters: probably Wi-Fi
- anything greater: probably cell-tower triangulation
These values are just off the top of my head—to be most accurate you’ll probably want to do some experimentation yourself.
edit - also worth noting is that determining the device you’re running on can give you more information about which location provider is being used. For instance, first-gen iPhones had no GPS, so if you’re running on one of those then your location is definitely coming from either cell towers or Wi-Fi; no iPod model to date has supported anything other than Wi-Fi triangulation; and only the 3G model of the iPad has ever had cell-tower triangulation and GPS.
来源:https://stackoverflow.com/questions/9263744/is-it-possible-to-determine-the-geolocation-method-used