Skip to content Skip to sidebar Skip to footer

Continues Speech Recognition Beep Sound After Google Search Update

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 b

Solution 1:

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

Solution 2:

Mute the beep by muting the notification sound:

(getSystemService(Context.AUDIO_SERVICE) as AudioManager).adjustStreamVolume(AudioManager.STREAM_NOTIFICATION, AudioManager.ADJUST_MUTE,0)

Make sure to unmute it after you start listening:

(getSystemService(Context.AUDIO_SERVICE) as AudioManager).adjustStreamVolume(AudioManager.STREAM_NOTIFICATION, AudioManager.ADJUST_UNMUTE,0)

Please note that there's a beep sound when the listening stops.

Solution 3:

The beep sound can be muted by using AudioManager

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

To unmute sound

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

Also add permission to Manifest.xml

<uses-permissionandroid:name="android.permission.MODIFY_AUDIO_SETTINGS"/>

Post a Comment for "Continues Speech Recognition Beep Sound After Google Search Update"