Continues Speech Recognition beep sound after Goog

2019-01-25 14:53发布

I have an app that keeps on listening to voice and converting it to commands using Google Voice API.

I have been using setStreamMute(AudioManager.STREAM_SYSTEM, true) to mute the beep and it worked until a couple of days ago before "Google Search" new update. Is there any workaround fix for it?

I know I can use setRingerMode(AudioManager.RINGER_MODE_SILENT), but maybe there is another method?

2条回答
别忘想泡老子
2楼-- · 2019-01-25 15:16

In the update they switched the output of the 'beep' to the media stream.

So you'll need to mute the AudioManager.STREAM_MUSIC

There's an enhancement request about it here

查看更多
ゆ 、 Hurt°
3楼-- · 2019-01-25 15:38

The beep sound can be muted by using AudioManager

AudioManager mAudioManager =(AudioManager)getSystemService(Context.AUDIO_SERVICE);
mAudioManager.setStreamMute(AudioManager.STREAM_MUSIC, true);

To unmute sound

AudioManager mAudioManager =(AudioManager)getSystemService(Context.AUDIO_SERVICE);
mAudioManager.setStreamMute(AudioManager.STREAM_MUSIC, false);

Also add permission to Manifest.xml

<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
查看更多
登录 后发表回答