0

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?

JOM
  • 8,139
  • 6
  • 78
  • 111
  • The CLLocationManager is hard to customize: [HowTo initialise MKMapView with a given user location?](http://stackoverflow.com/questions/1437568/howto-initialise-mkmapview-with-a-given-user-location) – jantimon Feb 05 '13 at 08:52

2 Answers2

0

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

swampie
  • 31
  • 3
  • R u conform if i set the distance filter value then GPS is turn off. – Naresh Venkat Feb 05 '13 at 09:10
  • As explained in this [answer](http://stackoverflow.com/questions/3411629/decoding-the-cllocationaccuracy-consts) using the kCLLocationAccuracyHundredMeters accuracy constant should not activate the GPS – swampie Feb 05 '13 at 09:18
  • That post first answer is suited for me.But is this provided by apple or not? – Naresh Venkat Feb 05 '13 at 11:43
  • @swampie in the link you posted itbis described that kCLLocationAccuracyHundredMeters could enable GPS in rural areas. – AlexWien Feb 05 '13 at 11:59
0

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.

AlexWien
  • 28,470
  • 6
  • 53
  • 83
  • speed attribute of the location object! measured in meters per second – AlexWien Feb 05 '13 at 12:41
  • I want to get the location updates every 1500 meters.So if i set desired accuracy as kCLLocationAccuracyThreeKilometers.Can i get the location updates for every 1500 meters or not. – Naresh Venkat Feb 05 '13 at 13:02
  • You can enable distanceFilter and set this to 1500m. But ios may enable GPS if 1500m cannot be aqchioved with celltowe or wifi. You cannot have both, no GPS and evry 1500m – AlexWien Feb 05 '13 at 16:20
  • If we set desiredaccuracy as kCLLocationAccuracyThreeKilometers then also cellular tower is working.SO why gps is enable. – Naresh Venkat Feb 06 '13 at 07:13
  • @NareshVenkat there is non garuantee that accuracyThreKilometers exludes GPS, see apple doku, "it gives the location Manager the flexibility to turn off GPS". if no cell tower is found, GPS is used anyway – AlexWien Feb 06 '13 at 13:03
  • SO if celltower is available then can i get location updates for every 1500 metrs – Naresh Venkat Feb 06 '13 at 13:16
  • Best you try it out, with my answer above you can test if the position was delivered by GPS or by cell tower. – AlexWien Feb 06 '13 at 17:35