gpt4 book ai didi

android - 通过语音识别发送消息?

转载 作者:行者123 更新时间:2023-11-30 03:27:16 24 4
gpt4 key购买 nike

当我说发送时,我使用以下代码发送消息“你好”。

Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);   
intent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE, getClass().getPackage().getName());
intent.putExtra(RecognizerIntent.EXTRA_PROMPT, metTextHint.getText().toString());
startActivityForResult(intent, VOICE_RECOGNITION_REQUEST_CODE);

onActivityResult() 中:

if(textMatchList.get(0).contains("send")) {    
Intent smsIntent = new Intent(Intent.ACTION_VIEW);
smsIntent.putExtra("sms_body", "Hello");
smsIntent.putExtra("address", "0123456789");
smsIntent.setType("vnd.android-dir/mms-sms");
startActivity(smsIntent);
}

如何使应用程序更加灵活。我的意思是,例如,如果我说“将此消息发送给迈克,嘿,伙计,你想去看电影。”我怎样才能让应用程序只使用重要信息,如 Send、Mike 和消息本身。然后像往常一样发送消息。还有如何在不进行硬编码的情况下使这一切成为可能。

网上有没有这方面的教程,如果有请给我一个链接,我将不胜感激。

谢谢

最佳答案

也许你可能会得到识别语音的文本并使用

if(text.contains("Mike")){
//send message to Mike (which i dont know how to do it,i am searching for this )
}

关于android - 通过语音识别发送消息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18041051/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com