Does kCLLocationAccuracyThreeKilometers use GPS or Cell Tower? - iphone

please tell me that if I use kCLLocationAccuracyThreeKilometers instead of kCLLocationAccuracyBest.
Then will my iPhone use GPS or Cell tower?.

It will use a mixture of the GPS Reciever built in, Cellular tower data and WiFi data to gather the best location estimate. There is no guarantee that it will use WiFi only nor is there a flag you can set so it only uses WiFi. If Cellular data is not available (for example in a remote location), it will fallback to WiFi and GPS Receiver.
Using kCLLocationAccuracyThreeKilometers may have it rely on WiFi more often but there is no 100% certainty. It does however use less power so if it's sufficient to your needs then you'd be better off using that flag.

Related

How to get current location

I know how can I fetch current location but I want does ios support different api for mobile network and wifi network for getting of current location or same api will use for both?
Does ios current location api will take care of both network connection?
Reference from
https://developer.apple.com/library/ios/DOCUMENTATION/CoreLocation/Reference/CLLocationManager_Class/CLLocationManager/CLLocationManager.html#//apple_ref/occ/cl/CLLocationManager
No, there is a single API for this case. What hardware the device uses is abstracted away for you. The desiredAccuracy property may however influence what hardware is used. If you request a kCLLocationAccuracyBestForNavigation accuracy it will most likely use the GPS hardware which is more expensive on battery. However if you request a kCLLocationAccuracyKilometer accuracy it will likely use cell tower information and triangulation strategies, but may consult the GPS hardware occasionally. You really should not need to worry about this when using the Core Location framework.

Get the location updates using wifi or cellular tower signal

I am developing an application, where I want to get the location details using CLLocationManager class. But if I call the startlocationupdating method, then GPS is started.
I don't want to get the location details using GPS. I want to turn GPS off and get the location details using WiFi or cellular towers. How I can do this?
From the CLLocationManager doc page (https://developer.apple.com/library/mac/#documentation/CoreLocation/Reference/CLLocationManager_Class/CLLocationManager/CLLocationManager.html)
For the services you do use, you should configure any properties associated with that service accurately. The location manager object manages power aggressively by turning off hardware when it is not needed. For example, setting the desired accuracy for location events to one kilometer gives the location manager the flexibility to turn off GPS hardware and rely solely on the WiFi or cell radios. Turning off GPS hardware can lead to significant power savings.
Basically the wifi location kicks in disabling the GPS decreasing your accuracy level
Set desiredAcuracy to kCLLocationAccuracyKilometer;
You can proove that you dont have GPS by:
you never get course (degrees) (may also called heading, correct me)
you never get speed (m/s)
from your CLLLocation object, especially when moving
Further if you
dont get altitude,
its not GPS, too (also works when vehicle is stand still
the other possibility is to avoid GPS is to enable location service with "significantLocantionChange" mode. But for this i have no personal experience.

Detect if Device has GPS

How to detect if GPS is available?
The iPod touch and iPad WiFi version don't have GPS, they have something else based on WiFi.
Anyway, how to know if GPS is available?
Or how to detect iPod Touch or iPad Wifi model?
This is a common difficulty on iOS... One way would be to get a location and check if the altitude is present.
if a valid altitude is present, the position has most probably been computed using GPS
else either the GPS has not picked-up any signal yet or it is not present.
Anyway on iOS Apple has a single interface for all location providers because they intend the developers to express their requirements in terms of accuracy, the control of the technology used should be left to the OS.
Not sure yet if my solution will cover every device... but... What I do is if it's an iPad ask if the device has a cellular connection (Know if iOS device has cellular data capabilities). If so, it will most likely also have GPS.
Not sure if this will cover every device correctly, but at least my test-devices are detected correctly.
To be 100% sure that it is a GPS loaction, check for attribute course. if this is valid then its from GPS. but when not moving course is invalid too.
you can use that condition as initial trigger that now you have GPS.
If you need an initial valid GPS when not moving, check for
vertical accuracy < 100 and horicontal < 50m

Get location of iPhone via GPS/IP

Im working on a application for which I need to decide in which country the user is. Which is the most accurate way to do this?
Should I use GPS or IP-adress?
What would be the pros/cons with each method?
I would use Apple's location services, which use several technologies (cell towers, WiFi hotspots, GPS, etc.) to determine their location. You can then find the country quite easily with a lookup of the GPS coordinates. I think this would be more accurate than by-IP lookups.
Its probably easier if you go via ip address and use a geo ip lookup service.
For GPS the GPS unit needs to be turned on. I guess lots of people disable it for energy saving. If you just turn on GPS for your check the user needs to get a gps fix first which can be time consuming as well.

How does CoreLocation locate the device?

More specifically, does CL require the user to have a data connection? Or is it possible to just use the phones service connection?
Thanks!
It actually uses several mechanisms.
GPS
Cell Tower Triangulation
Wifi Hotspot cataloging
Randomly assuming you are in Cupertino
There are tradeoffs based on speed, precision, and available hardware. A first Gen iPad will only have the 3 option available while the iPhone simulator makes use of the last mechanism.
You can observe the difference in these systems in the map application where it initially guesses based on the cell tower, then refines the guess via GPS.
Only options #3 requires a data connection.
And for the humor impaired including #4 was not totally serious although it is functionally correct. (I think they simulate the GPS reporting that location rather than just hard coding it, but I haven't checked.)
You can set the phone into airplane mode and still get a location :)
It will be forced to use GPS to get it so it might take longer to get though.