简体   繁体   中英

Is it possible to playback some text using Google Assistant?

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?

I haven't found any solution on playing voice using the Assistant but I could play voice using TextToSpeech.speak. Very simple.

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);
                }
            }
        });

The only problem is that I cannot use the same voice but it works very well and it is very simple.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM