Code example for TextToSpeech

Methods: shutdown, speak

0
	/** 
	 * When the service is started the TextToSpeech engine is run, speaking aloud the received message.  
	 */ 
	@Override 
	protected void onHandleIntent(Intent intent) {
		TextToSpeech tts = new TextToSpeech(getApplicationContext(), this);
		Bundle bundle = intent.getExtras();
		String message = bundle.getString("message");
		String address = bundle.getString("address");
		tts.speak("New message from " + address + ". Message: " + message, TextToSpeech.QUEUE_ADD, null);
		tts.shutdown();
	} 
	 
	public void onInit(int arg){
		if(arg == 0){
			//successfull init 
		} 
		 
	} 
 
}