we've just upgraded to Skobbler SDK 2.4 with our B2B-App. Now we've got following problem:
When calculation the Route, the App crashes with a nullpointer exception after calling SKRouteManager.getInstance().calculateRoute.
Here is the Code: (before upgrading it worked very well...)
SKRouteSettings route = new SKRouteSettings();
route.setStartCoordinate(ApplicationData.getInstance().getCurrentCoordinate());
route.setDestinationCoordinate(goal);
route.setNoOfRoutes(1);
route.setRouteMode(SKRouteSettings.SKRouteMode.PEDESTRIAN);
route.setAlternativeRouteModes(new ArrayList<SKRouteAlternativeSettings>()); route.setRouteConnectionMode(SKRouteSettings.SKRouteConnectionMode.OFFLINE);
route.setRouteExposed(true);
route.setViaPoints(new ArrayList<SKViaPoint>());
SKRouteManager.getInstance().setRouteListener(this);
SKRouteManager.getInstance().setAudioAdvisorSettings(new SKAdvisorSettings());
SKRouteManager.getInstance().calculateRoute(route);
The empty ArrayLists are tests for troubleshooting.
Is there a known issue with 2.4 or does anything else change with the Update?
I was having the exact same issue as you. Routes worked with the old SDK, not so much with the new SDK.
After working through this a bit, I think your issue stems from this line:
SKRouteManager.getInstance().setAudioAdvisorSettings(new SKAdvisorSettings());
Try this code instead, for setting the audio advisor:
final SKAdvisorSettings advisorSettings = new SKAdvisorSettings();
advisorSettings.setLanguage(SKAdvisorSettings.SKAdvisorLanguage.LANGUAGE_EN);
advisorSettings.setAdvisorConfigPath(context.getFilesDir() + "/SKMaps/Advisor");
advisorSettings.setResourcePath(context.getFilesDir() + "/SKMaps/Advisor/Languages");
advisorSettings.setAdvisorVoice("en");
advisorSettings.setAdvisorType(SKAdvisorSettings.SKAdvisorType.AUDIO_FILES);
SKRouteManager.getInstance().setAudioAdvisorSettings(advisorSettings);
This code needs to be called some time before you calculate the route. I like to put mine well above the rest of the code, to keep them separate (i.e. the block that I just posted can go right above the code you posted)
The only change you might want to make is to change these lines:
advisorSettings.setAdvisorConfigPath(context.getFilesDir() + "/SKMaps/Advisor");
advisorSettings.setResourcePath(context.getFilesDir() + "/SKMaps/Advisor/Languages");
So that they point to the correct location of your SKMaps/Advisor folders. I am always using internal application storage, so context.getFilesDir() will always work for me. This won't work for you if you are using external storage, or storing the SKMaps file somewhere else.
Hope this helps :)