The core component of Navmii SDK responsible for route navigation is NMRouteNavigator. This class provides the API to control the route navigation process, to get navigation information and guidance updates. The class is also able to handle the rerouting and the rerouting by traffic.
...
NMSdk class contains the routeNavigator
property providing access to the instance of NMRouteNavigator. The route navigator instance can be accessed only after the SDK was started.
...
The alternativeRoutes
parameter is a list of alternative routes with the latest traffic applied, which can be used for navigation. Use startNavigatingTheRoute:
method to start navigation along one of the alternative routes.
GUIDANCE
Navmii SDK allows you to setup the way the navigation guidance will be provided. It's possible throughout the NMRouteNavigator's instance property guidanceSettings. You can set the guidance output either to text or switch it off. If you pass NMGuidanceOutputText to the NMGuidanceSettings's property guidanceOutput, you'll be able to receive NSString instances with navigation guidance in NMNavigationListener - (void)onGuidanceTextReady:(NSString *)guidanceText method.
- (void)onGuidanceTextReady:(NSString *)guidanceText {
NSLog(guidanceText);
}
You can also set guidance language via the NMGuidanceSettings's locale property. To get the list of all languages supported by the SDK use the supportedLocales property.
// Sets guidance language to American English
NMGuidanceSettings *settings = navigator.guidanceSettings;
settings.locale = @"en-US";
Currently supported languages:
Czech
Danish
English (UK)
English (US)
Finnish
French (France)
German
Italian
Korean
Norwegian
Polish
Portugese (Brazil)
Portugese (Portugal)
Russian
Spanish (Spain)
Swedish
Turkish
Voice guidance
It's also possible to receive voice guidance instructions. To do this, first set the path to the directory containing the voice packs by using the NMConfigurationSettings property voicePacksPath. After initialising the SDK, you can retrieve the list of available voice packs with the NMGuidanceSettings availableVoicePacks property, and select one using NMGuidanceSettings voicePack. By passing NMGuidanceOutputVoice to the NMGuidanceSettings guidanceOutput property, directions will be announced using the chosen voice pack.
Example:
Code Block | ||||
---|---|---|---|---|
| ||||
- (void)configureSDK {
//Setup Voice Resources here.
NMConfigurationSettings *configurationSettings = [NMConfigurationSettings new];
configurationSettings.voicePacksPath = [[NSBundle mainBundle] URLForResource:@"VoicePacksFolder" withExtension:nil].path;
}
- (void)setVoiceGuidance {
//Request available voice packs and pass selected one to settings.
NMRouteNavigator *navigator = navmiiSDK.routeNavigator;
NMGuidanceSettings *guidanceSettings = navigator.guidanceSettings;
NSArray<NMVoicePack *> *voicePacks = guidanceSettings.availableVoicePacks;
if ([voicePacks count] > 0) {
NMVoicePack *voicePack = ...// select voice pack here
guidanceSettings.voicePack = voicePacks;
guidanceSettings.guidanceOutput = NMGuidanceOutputVoice;
}
}
|