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()
- when receiving a location update (or any other time) you can ask & log the currently known position via the getCurrentGPSPosition API ( via the matched paremeter you can ask either for the real position or the "matched on road" position)