play something when recieve call android
<p>i want to play text to speech of " Hello World" (for example)  when someone call you instead of the deafult ringer (i want to do it programatically):
this code is really mute my ringtone however it didnt play the "hello world" tts, only when i reject the call it plays the "hello world" String...and i want that the phone will mute the deafult ringtone and instead of it will play the "hello world" string...someone has any idea what is the problem with my code?</p>

<p>thanks</p>

<pre><code>private PhoneStateListener mPhoneListener = new PhoneStateListener() {

          public void onCallStateChanged(int state, String incomingNumber) {

           try {
            switch (state) {
            case TelephonyManager.CALL_STATE_RINGING:

            //----------------------------silence call-----------------------------
              AudioManager audiomanage = (AudioManager)getSystemService(Context.AUDIO_SERVICE);
              audiomanage.setRingerMode(AudioManager.RINGER_MODE_SILENT);
                  String name="Hello world";
                 Intent checkIntent = new Intent();
               checkIntent.setAction(TextToSpeech.Engine.ACTION_CHECK_TTS_DATA);
               startActivityForResult(checkIntent, MY_DATA_CHECK_CODE);
</code></pre>
