diff --git a/android/app/src/main/java/app/organicmaps/MwmActivity.java b/android/app/src/main/java/app/organicmaps/MwmActivity.java
index 5c6f6b80d..57a243c61 100644
--- a/android/app/src/main/java/app/organicmaps/MwmActivity.java
+++ b/android/app/src/main/java/app/organicmaps/MwmActivity.java
@@ -1818,9 +1818,17 @@ public class MwmActivity extends BaseMwmFragmentActivity
if (Config.isTtsMessageDelivered())
return;
- String navigationStartMessage = getResources().getString(R.string.navigation_start_tts_message);
- navigationStartMessage += TtsPlayer.INSTANCE.getLanguageDisplayName();
- Toast.makeText(this, navigationStartMessage, Toast.LENGTH_LONG).show();
+ String languageDisplayName = TtsPlayer.INSTANCE.getLanguageDisplayName();
+
+ if (languageDisplayName != null)
+ {
+ String navigationStartMessage = getResources().getString(R.string.navigation_start_tts_message);
+ navigationStartMessage += languageDisplayName;
+ Toast.makeText(this, navigationStartMessage, Toast.LENGTH_LONG).show();
+ }
+ else
+ Toast.makeText(this, getResources().getString(R.string.navigation_start_tts_disabled_message), Toast.LENGTH_LONG)
+ .show();
Config.setTtsMessageDelivered();
}
diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xml
index b89b48755..2679300f9 100644
--- a/android/app/src/main/res/values/strings.xml
+++ b/android/app/src/main/res/values/strings.xml
@@ -934,6 +934,7 @@
Delete %s?
No text-to-speech engine found, check the app settings
"Starting Navigation, voice instruction language: "
+ "Voice instructions disabled: TTS engine not available"
unknown
Type 2 (no cable)
Type 2 (w/ cable)
diff --git a/android/sdk/src/main/java/app/organicmaps/sdk/sound/TtsPlayer.java b/android/sdk/src/main/java/app/organicmaps/sdk/sound/TtsPlayer.java
index d9903bf3d..64d5d124a 100644
--- a/android/sdk/src/main/java/app/organicmaps/sdk/sound/TtsPlayer.java
+++ b/android/sdk/src/main/java/app/organicmaps/sdk/sound/TtsPlayer.java
@@ -10,6 +10,7 @@ import android.os.Looper;
import android.provider.Settings;
import android.speech.tts.TextToSpeech;
import android.speech.tts.UtteranceProgressListener;
+import android.speech.tts.Voice;
import android.text.TextUtils;
import android.util.Pair;
import androidx.annotation.NonNull;
@@ -280,13 +281,16 @@ public enum TtsPlayer
public Locale getVoiceLocale()
{
- return mTts.getVoice().getLocale();
+ if (INSTANCE.mTts == null)
+ return null;
+ Voice voice = INSTANCE.mTts.getVoice();
+ return voice != null ? voice.getLocale() : null;
}
public String getLanguageDisplayName()
{
Locale locale = getVoiceLocale();
- return locale.getDisplayName(locale);
+ return locale != null ? locale.getDisplayName(locale) : null;
}
public void speak(String textToSpeak)