Search code examples
androidskmaps

How to play audio file?


How do you actually play the audio file from the SKNavigationListener?

     @Override
    public void onSignalNewAdviceWithAudioFiles(String[] audioFiles, boolean specialSoundFile) {}

Solution

  • Please see the demo project for an example:

     @Override
        public void onSignalNewAdviceWithAudioFiles(String[] audioFiles, boolean specialSoundFile) {
            // a new navigation advice was received
            SKLogging.writeLog(TAG, " onSignalNewAdviceWithAudioFiles " + Arrays.asList(audioFiles), Log.DEBUG);
            SKToolsAdvicePlayer.getInstance().playAdvice(audioFiles, SKToolsAdvicePlayer.PRIORITY_NAVIGATION);
        }
    

    You can use any other audio player you see fit - the SKTools implementation is provided for convenience.