I am trying to get the Points(coordinates) traveled on the Route while navigating. SKnavigationState does not provide any latlon coordinates on ongoing navigation to the route.
How do I get the coordinates of the user's position on the route while navigation is taking place?
There are a number of ways of doing this:
private void startNavigation()
{
//..... navigation settings
if (configuration.getNavigationType() == SKNavigationSettings.SKNavigationType.REAL) {
navigationSettings.setNavigationType(SKNavigationSettings.SKNavigationType.REAL);
Date date = new Date();
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss");
final File navigationLogsFolder = new File(Environment.getExternalStorageDirectory() + File.separator + "LogFileName" + File.separator);
if (!navigationLogsFolder.exists()) {
navigationLogsFolder.mkdirs();
}
final String fileName = navigationLogsFolder.getAbsolutePath() + "/" + dateFormat.format(date);
SKPositionLoggingManager.getInstance().startLoggingPositions(fileName, SKPositionLoggingManager.SPositionLoggingType.SK_POSITION_LOGGING_TYPE_LOG);
}
navigationManager.startNavigation(navigationSettings);
}
When you want to stop the logging process please call SKPositionLoggingManager().stopLoggingPositions()