0

I have an android app with a custom intent that is fired by the Google Assistant with some text like "open my app and activate some action" (for example, "open clients database and sort clients"). All this is done very well but I would like to add some speech once the job is done, maybe a "job done" text or more specific "clients list is now sorted". Is this possible with the Assistant. Can we send back a result for it to speak it?

4

1 回答 1

0

我还没有找到任何关于使用助手播放语音的解决方案,但我可以使用 TextToSpeech.speak 播放语音。很简单。

TextToSpeech oTextToSpeech=new TextToSpeech(getApplicationContext(), new TextToSpeech.OnInitListener() {
            @Override
            public void onInit(int status) {
                if(status != TextToSpeech.ERROR) {                        
                    oTextToSpeech.speak("Hello this is a test", TextToSpeech.QUEUE_ADD, null);
                }
            }
        });

唯一的问题是我不能使用相同的声音,但它工作得很好而且很简单。

于 2020-11-19T10:07:51.393 回答