GMSLocationSimulator Class Reference

GMSLocationSimulator Class Reference

Overview

A class you can use to simulate a device location for testing purposes.

Public Member Functions

(void) - simulateLocationsAlongExistingRoute
 Starts simulating travel along the route currently set on the GMSNavigator.
(void) - simulateAlongNewRouteToDestinations:callback:
 Calculates a route to the given waypoints and simulates travel along this route.
(void) - simulateAlongNewRouteToDestinations:routingOptions:callback:
 Calculates a route to the given waypoints, and simulates travel along this route.
(void) - simulateLocationAtCoordinate:
 Starts simulating the device location at a fixed coordinate.
(void) - stopSimulation
 Stops simulating the device location if it is currently being simulated.
(void) - simulateNavigationPrompt
 Diplays a navigation prompt with fake data for testing purposes.
(void) - simulateTrafficIncidentReport
 Displays a dummy traffic prompt for testing purposes.

Properties

BOOL paused
 Whether the simulation is currently paused.
BOOL avoidsHighways
 Whether to avoid highways when simulating travel to destinations with the simulateAlongNewRouteToDestinations:callback: method.
BOOL avoidsTolls
 Whether to avoid toll roads when simulating travel to destinations with the simulateAlongNewRouteToDestinations:callback: method.
BOOL avoidsFerries
 Whether to avoid ferries when simulating travel to destinations with the simulateAlongNewRouteToDestinations:callback: method.
float speedMultiplier
 The speed multiplier to use when simulating travel along a route.
BOOL locationJitteringEnabled
 Whether the simulated location should jitter randomly.
GMSNavigationLicensePlateRestrictionlicensePlateRestriction
 Set license plate restriction with current vehicle's last digit of license plate and country code.

Member Function Documentation

Starts simulating travel along the route currently set on the GMSNavigator.

If the GMSNavigator does not have a route, this does nothing.

- (void) simulateAlongNewRouteToDestinations: (NSArray< GMSNavigationWaypoint * > *)  destinations
callback: (GMSRouteStatusCallback)  callback 

Calculates a route to the given waypoints and simulates travel along this route.

The new route will use the travel mode that is set on the GMSMapView.

Travel will be started just before the callback is called with GMSRouteStatusOK. If the callback returns any value other than GMSRouteStatusOK, no simulation will start. If any other simulator methods are called before the route is generated, route generation will be canceled and the callback will be called with GMSRouteStatusCanceled.

Parameters:
destinationsThe list of destinations for the route that will be simulated.
callbackA block that will be called when the route becomes available or fails.
- (void) simulateAlongNewRouteToDestinations: (NSArray< GMSNavigationWaypoint * > *)  destinations
routingOptions: (GMSNavigationRoutingOptions *)  routingOptions
callback: (GMSRouteStatusCallback)  callback 

Calculates a route to the given waypoints, and simulates travel along this route.

The new route will use the travel mode which is set on the GMSMapView.

Travel starts right before the callback is invoked with GMSRouteStatusOK. If the callback returns a value other than GMSRouteStatusOK, then no simulation starts. If any other simulator methods are called before the route is generated, then route generation will be canceled, and the callback will be called with GMSRouteStatusCanceled.

Parameters:
destinationsThe list of destinations for the route that will be simulated.
routingOptionsThe routing logic that will determine the returned route.
callbackA block that will be called when the route becomes available or fails.
- (void) simulateLocationAtCoordinate: (CLLocationCoordinate2D)  coordinate

Starts simulating the device location at a fixed coordinate.

- (void) stopSimulation

Stops simulating the device location if it is currently being simulated.

Diplays a navigation prompt with fake data for testing purposes.

Displays a dummy traffic prompt for testing purposes.


Property Documentation

- (BOOL) paused [read, write, assign]

Whether the simulation is currently paused.

If this is set to YES whilst simulating along a route, then location updates will still be sent periodically, but the location will stop advancing along the route.

- (BOOL) avoidsHighways [read, write, assign]

Whether to avoid highways when simulating travel to destinations with the simulateAlongNewRouteToDestinations:callback: method.

Defaults to NO.

- (BOOL) avoidsTolls [read, write, assign]

Whether to avoid toll roads when simulating travel to destinations with the simulateAlongNewRouteToDestinations:callback: method.

Defaults to NO.

- (BOOL) avoidsFerries [read, write, assign]

Whether to avoid ferries when simulating travel to destinations with the simulateAlongNewRouteToDestinations:callback: method.

Defaults to YES.

- (float) speedMultiplier [read, write, assign]

The speed multiplier to use when simulating travel along a route.

The value of this property must be positive. Attempting to set a non-positive value will have no effect. The default value is 1.0.

- (BOOL) locationJitteringEnabled [read, write, assign]

Whether the simulated location should jitter randomly.

Set license plate restriction with current vehicle's last digit of license plate and country code.

This allows us to route around certain types of road restrictions which are based on license plate number. This will only apply to simulateAlongNewRouteToDestinations calls made after this value is set.

Set to nil if there is no license plate restriction. Default to nil.