AI-generated Key Takeaways
-
GMSNavigationSession
provides programmatic control over navigation sessions, requiring prior acceptance of terms and conditions. -
Starting a session enables guidance activation via its navigator and location updates from its road-snapped location provider.
-
Includes properties for travel mode, a location simulator for testing, a navigator for guidance, and a road-snapped location provider.
-
Instances are obtained through
GMSNavigationServices
, not direct initialization. -
The
started
property manages whether navigation is actively running and receiving location updates.
GMSNavigationSession
@interface GMSNavigationSession : NSObject
This class provides a set of related objects that can be used to programmatically control a navigation session.
-
Whether or not navigation on this session is started.
A session cannot be started unless terms and conditions have previously been accepted.
Starting a session is a prerequisite for activating guidance on the session’s navigator, or for starting location updates from the session’s road-snapped location provider.
A started session receives location from CoreLocation as determined by the application’s location authorization. Your app can temporarily stop the Navigation SDK from requesting location updates. For instance, it might do this in order to reduce battery usage in a period when location updates are known to be unnecessary.
Declaration
Swift
var isStarted: Bool { get set }
Objective-C
@property (nonatomic, getter=isStarted) BOOL started;
-
The travel mode for this session.
Declaration
Swift
var travelMode: GMSNavigationTravelMode { get set }
Objective-C
@property (nonatomic) GMSNavigationTravelMode travelMode;
-
An instance of
GMSLocationSimulator
which can be used to simulate locations for this session, or nil if terms and conditions have not been accepted.Declaration
Swift
var locationSimulator: GMSLocationSimulator? { get }
Objective-C
@property (nonatomic, readonly, nullable) GMSLocationSimulator *locationSimulator;
-
The instance of
GMSNavigator
managing this navigation session, or nil if terms and conditions have not been accepted.Declaration
Swift
var navigator: GMSNavigator? { get }
Objective-C
@property (nonatomic, readonly, nullable) GMSNavigator *navigator;
-
The road-snapped location provider for this session, or nil if terms and conditions have not been accepted.
Declaration
Swift
var roadSnappedLocationProvider: GMSRoadSnappedLocationProvider? { get }
Objective-C
@property (nonatomic, readonly, nullable) GMSRoadSnappedLocationProvider *roadSnappedLocationProvider;
-
Unavailable
Instances of this class should be obtained by calling the method on
GMSNavigationServices
.Declaration
Objective-C
- (nonnull instancetype)init;