Route Sharing (v2.1.x – 2.2.x)
The NMRouteSharingManager
class in the SDK is responsible for managing the sharing of routes. This includes starting and stopping the route sharing process and checking if the route sharing is currently active.
An instance of the NMRouteSharingManager
can be retrieved using the NMSdk
property routeSharingManager
.
The NMRouteSharingManager
class provides the following functionality:
Starting route sharing using the
startRouteSharingWithCredentials:listener:
method.Stopping route sharing using the
stopRouteSharing
method.Checking if route sharing is active using the
isRouteSharingStarted
method.
Listening for route sharing events
The NMRouteSharingListener
is an abstract class that handles route sharing events. Implement this listener to receive notifications about the status of the route sharing.
- (void)onRouteSharingStartedWithUrl:(nonnull NSString *)urlString
: Called once route sharing is started. TheurlString
parameter will contain a link to the webpage where the shared route can be viewed.- (void)onRouteSharingFailedWithError:(NMRouteSharingError)error
: Called if route sharing fails.- (void)onRouteSharingStopped
: Called once route sharing is stopped.
Example:
NMRouteSharingManager *routeSharingManager = pathwayProSDK.routeSharingManager;
NMRouteSharingMapAccessCredentials *credentials = [[NMRouteSharingMapAccessCredentials alloc] initWithAccountId:@""
emailId:@""
password:@""
serviceId:@1234
cdnServiceId:@4321];
[routeSharingManager startRouteSharingWithCredentials:credentials listener: self];
// ...
// Stop route sharing when necessary
[routeSharingManager stopRouteSharing];
// ...
// Check if route sharing is active
BOOL isRouteSharingStarted = routeSharingManager.isRouteSharingStarted;
NSLog(@"isRouteSharingStarted: %@", isRouteSharingStarted ? @"YES" : @"NO");