GMSRoadSnappedLocationProvider
@interface GMSRoadSnappedLocationProvider : NSObject
Provides updates of the device’s location. This class functions similarly to CLLocationManager, except that if the device is in driving mode, the location updates is snapped to the nearest road.
This class is not intended for subclassing.
-
Unavailable
Declaration
Objective-C
- (instancetype)init NS_UNAVAILABLE;
-
Adds a listener. The listener is held with a weak reference.
Declaration
Swift
func add(_ listener: any GMSRoadSnappedLocationProviderListener)
Objective-C
- (void)addListener: (nonnull id<GMSRoadSnappedLocationProviderListener>)listener;
Parameters
listener
An object conforming to the
GMSRoadSnappedLocationProviderListener
protocol. -
Removes a listener.
Declaration
Swift
func remove(_ listener: any GMSRoadSnappedLocationProviderListener) -> Bool
Objective-C
- (BOOL)removeListener: (nonnull id<GMSRoadSnappedLocationProviderListener>)listener;
Parameters
listener
An object conforming to the
GMSRoadSnappedLocationProviderListener
protocol.Return Value
Returns YES if the listener was removed. Returns NO if the object was not a listener.
-
Starts updating the device’s road-snapped location. After this is called, the delegate will start receiving location update events.
In order to avoid battery drain or unintended logging of device location,
-stopUpdatingLocation
should be called when road-snapped location is no longer required.Declaration
Swift
func startUpdatingLocation()
Objective-C
- (void)startUpdatingLocation;
-
Stops updating the device’s road-snapped location. In order to avoid battery drain or unintended logging of device location, this method should be called when the listener is no longer required.
Declaration
Swift
func stopUpdatingLocation()
Objective-C
- (void)stopUpdatingLocation;
-
Whether the delegate should still receive location updates when the app is in the background. Defaults to NO.
Declaration
Swift
var allowsBackgroundLocationUpdates: Bool { get set }
Objective-C
@property (nonatomic) BOOL allowsBackgroundLocationUpdates;