Shan
Shan

Reputation: 2832

Text to speech problem with incoming call in Android

whether there is anyway to stop the TTS when a incoming call comes to my phone? via code?

Upvotes: 2

Views: 1486

Answers (1)

Rohit Mandiwal
Rohit Mandiwal

Reputation: 10462

You can see the incoming call notification from link http://peacemoon.wordpress.com/2009/08/06/android-listening-to-incomingoutgoing-phone-calls/

and stop the TTS as below

 public void onDestroy() {
        // Don't forget to shutdown!
        if (mTts != null) {
            mTts.stop();
            mTts.shutdown();
        }

        super.onDestroy();
    }

where mts is

mTts = new TextToSpeech(this,
            this  // TextToSpeech.OnInitListener
            );

Upvotes: 1

Related Questions