gpt4 book ai didi

android - ACTION_VOICE_COMMAND 什么都不做

转载 作者:行者123 更新时间:2023-11-29 15:35:48 28 4
gpt4 key购买 nike

我正在使用此代码 fragment 在 Android 上激活语音命令。

  Intent newIntent = new Intent(Intent.ACTION_VOICE_COMMAND);
newIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
getApplicationContext().sendBroadcast(newIntent);

它没有做任何事情,甚至在我的日志猫中也没有错误:

06-03 13:26:24.325 203-822/? D/audio_hw_primary: out_set_parameters: enter: usecase(1: low-latency-playback) kvpairs: routing=2
06-03 13:26:24.335 203-822/? D/audio_hw_primary: select_devices: out_snd_device(2: speaker) in_snd_device(0: none)
06-03 13:26:24.335 203-822/? D/msm8974_platform: platform_send_audio_calibration: sending audio calibration for snd_device(2) acdb_id(15)
06-03 13:26:24.335 203-822/? D/audio_hw_primary: enable_snd_device: snd_device(2: speaker)
06-03 13:26:24.338 203-822/? D/audio_hw_primary: enable_audio_route: apply and update mixer path: low-latency-playback

--------- beginning of system
06-03 13:26:26.277 786-892/? D/ConnectivityService: notifyType CAP_CHANGED for NetworkAgentInfo [WIFI () - 100]
06-03 13:26:27.551 203-822/? D/audio_hw_primary: disable_audio_route: reset and update mixer path: low-latency-playback
disable_snd_device: snd_device(2: speaker)

当我在 ADB 中运行它时,它会启动谷歌助手:

adb shell am start -a android.intent.action.VOICE_COMMAND

这很奇怪,从技术上讲这是一回事。是否有我遗漏的权限?

最佳答案

From Docs

Activity Action: Start Voice Command.

所以要调出语音命令助手 Activity ,使用startActivityas

getApplicationContext().startActivity(newIntent);

代替

getApplicationContext().sendBroadcast(newIntent);

喜欢

Intent newIntent = new Intent(Intent.ACTION_VOICE_COMMAND);
newIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
getApplicationContext().startActivity(newIntent);
// ^^^^^^^^^^^^

is there a way for the UI not to come up and cover my UI? or at least for google assistant to go away after it listened and acted on my voice command?

您可以使用 Google Assistant Service sdk这是android quick start guide

关于android - ACTION_VOICE_COMMAND 什么都不做,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50670682/

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