How to check user location provided by WIFi or GPS - ios

CLLocationManager Class provide location by GPS, WIFI or cellular, is there any way to check location provided by WIFI.
I know CLLocationManager class used GPS, WIFI on the basis of desiredAccuracy property.

GPS location readings show non negative speed. WiFi and cell tower triangulation locations have speed set to -1.

Related

Exact coordinates from ios app

I'm creating a tracking application and ios application is the front end to gather the coordinates. Issue is my ios application is not giving the exact path followed. Im using this code to gather coordinates
locationMgr.desiredAccuracy = kCLLocationAccuracyBestForNavigation
locationMgr.delegate = self
//locationMgr.allowDeferredLocationUpdatesUntilTraveled(1.0, timeout:100)
locationMgr.requestWhenInUseAuthorization()
locationMgr.pausesLocationUpdatesAutomatically=false
locationMgr.distanceFilter=1
locationMgr.startUpdatingLocation()
I'm using coordinates gathered upto 8th decimal point such as 34.98776555
but Out put is not straight one that I followed. Please help
GPS Positioning typically has an accuracy of 1-5 meters. There are additional factors that can reduce the accuracy further.
As per the excerpt from the following website : How Accurate is the GPS on my Smart Phone?
For any GPS to work the antennae needs a clear view of the sky. Users of smart phones will frequently be in “urban canyons” or indoors. This is where WiFi and cellular network positioning become necessary. Both of these methods are used by smart phones as indoor positioning systems. The phone will use a hybrid approach, using all three methods to locate you. These other two technologies aren’t nearly as accurate as A-GPS, but can still locate you sufficiently to find the closest vanilla latte!
Generally WiFi positioning is more accurate than cellular network
positioning. It uses wireless access points and measures the
intensity of the received signal from one or more networks to find the
position. Interestingly it doesn’t require your device to be WiFi
enabled to work.
Cellular network positioning triangulates your position based off of
nearby cell phone towers. Phone companies have precise locations for
their cell towers, which when combined with signal strength can be
used to approximate your location. Both of these techniques are
dependent on overlapping signals from either access points and
cellular towers. Therefore they’re more accurate in urban settings.
CLLocationManger has an attribute called horizontalAccuracy which you can use to ignore points if they aren't accurate enough as per your requirements.
public func locationManager(manager: CLLocationManager, didUpdateToLocation newLocation: CLLocation, fromLocation oldLocation: CLLocation){
print(newLocation.coordinate.latitude)
print(newLocation.coordinate.longitude)
print(newLocation.horizontalAccuracy)
}
A GPS point which is off by just 1-2 meters will cause that point to get plotted off the road. From my experience getting pinpoint accuracy will be difficult and there is nothing that can be done about it.

How to show an iBeacon in a map

Once an app finds a beacon is possible to show both in a map (the device that found the beacon and the beacon itself)? If so how can i do that? I tried work with the distance bit with no success so far.
Unfortunately, you can't just find the exact location of an iBeacon once it's detected. You can only estimate its distance away from the device.
The proximity property tells you the relative distance (far, immediate, or close) that the beacon is away from the device while the accuracy property tells you how accurate that value is; so you can use proximity in combination with accuracy to get a general approximation of the distance. You could also potentially use these properties in combination with the RSSI, i.e. the received signal strength of the beacon, to further approximate the relative distance.
The device on the other hand can be mapped easily by turning on the map's showsUserLocation property.
I suppose your map is a MKMapView. If you know the precise location of the beacon (by having use a GPS to get the coordinates of the beacon when you have installed it) you can add an annotation on your MKMapView.
Take a look at MKMapView - (void)addAnnotation:(id < MKAnnotation >)annotation method for that.
If you don't have a database where to fetch the GPS coordinates of your beacons, there is no way to display them on a map as a beacon knows nothing about its surroundings.
By the way the accuracy property of a CLBeacon object isn't reliable enough for positioning.

What do horizontalAccuracy and verticalAccuracy of a CLLocation refer to?

I've been working on a location based app recently and am noticing some strange values for CLLocation. I often get a horizontalAccuracy of 1414 and a verticalAccuracy of -1. Any clue what this indicates? As far as I can tell, these points are often very accurate. What is the difference between verticalAccuracy and horizontalAccuracy?
The -1 for verticalAccuracy indicates that the altitude in the CLLocation is not valid. You only get altitude with a 3D GPS position.
The 1414 for horizontalAccuracy indicates that the horizontal (lat/lon) position could be up to 1414m off (this is just an estimated error). This is probably a location determined by cell tower triangulation or WiFi location data. GPS locations usually report 100m or better.
To get a higher accuracy location (300m or better) you need to set desiredAccuracy and wait for the GPS receiver to lock onto at least 3 satellites (or 4 for a 3D fix). Until that happens CLLocationManager will give you the best it has which is WiFi or Cell tower triangulation results.

Check whether a CLLocation is based on GPS or cellular

With a 3G GPS device (i.e. iPad 3G) is there a way to know if a reported CLLocation is based on a GPS signal, and not the inaccurate cellular data?
The CLLocation class has a method called -horizontalAccuracy:. This will give you some idea of the radius of accuracy of that measurement. This is probably better than asking just "is it GPS" because GPS readings can also be pretty inaccurate, depending on receiving conditions and satellite visibility.

How can i determine if iphones CoreLocation is using satellites or cell tower triangulation to find the current location?

I'm using CoreLocation to find a users current location and display it on a map. I want to show an icon with an antenna when the location is established using satellites and a icon with towers when it uses tower cell triangulation. In my test app i set the desired accuracy to be kCLLocationAccuracyNearestTenMeters if using tower cell triangulation this may never be reached but when it uses satellites i had promising results.
How can i determine the mode of retrieving the current location, satellites or towers, should i see if the accuracy provided by CoreLocation is less than the desired one then is using satellites and if not is using tower cell triangulation or there is another way?
The framework does not expose the method(s) by which it determined the location.
One way to distinguish GPS updates: the altitude parameter is set.
While the framework does not expose which hardware device is providing location information, it does provide accuracy information with the properties: horizontalAccuracy and verticalAccuracy. You can fake it by looking at how precise those values are.

Resources