0

I need to get location updates in my view controller using GMSMapView. For this I have added observer for myLocation:

   [_googleMapView addObserver:self forKeyPath:@"myLocation" options:NSKeyValueObservingOptionNew context:NULL];

and I also have to do:

   _googleMapView.myLocationEnabled = YES;

then only I get the updates, but enabling myLocation also shows blue annotation at my current location which I do not want. How can I get location updates without showing myLocation blue dot annotation using GMSMapView (not Apple's CLLocationManager) in my View controller. Pls help.

Zaraki
  • 3,720
  • 33
  • 39

1 Answers1

0

According to the Google Maps iOS documentation:

myLocationEnabled: Controls whether the My Location dot and accuracy circle is enabled. myLocation: If My Location is enabled, reveals where the user location dot is being drawn.

So, setting:

_googleMapView.myLocationEnabled = NO;
  • (CLLocation*) myLocation [read, assign]: If My Location is enabled, reveals where the user location dot is being drawn. If it is disabled, or it is enabled but no location data is available, this will be nil. This property is observable using KVO.

Should allow you to access the location without having the blue dot appear.

geekchic
  • 2,371
  • 4
  • 29
  • 41
  • so do you mean that setting myLocationEnabled to YES or NO only shows/hides the annotation and I will get the location updates in both the cases? – Zaraki Aug 13 '13 at 05:45
  • Hmm, I'm intrigued by this. I'll try it myself and get back to you. – geekchic Aug 14 '13 at 10:13
  • I'm having the same problem. My best guess is that myLocation shows the location where the mapview is going to draw the dot. So when the dot is disabled, the API sees no reason to update myLocation. – Rubberduck Aug 26 '13 at 11:17
  • Yup. The documentation says about myLocation: "If My Location is enabled, reveals where the user location dot is being drawn. If it is disabled, or it is enabled but no location data is available, this will be nil." – Rubberduck Aug 26 '13 at 12:00