zapl が言ったように、それを行う直接的な方法はありませんが、システム ボリュームをミュートしてみてください。Tencent は、あらゆる種類のハッキングを回避していると述べています。それから、これを行う方法は今のところないと言わざるを得ませんが、それでも、同じ問題に苦しんでいて、「ハック」トリックを気にしない人のために、このトリックソリューションを共有しています. 欲求不満の時間を節約するだけです。
その特定の時間のシステム ボリュームをミュートし、その後ミュートを解除します。これを行う方法:
クラスで、次のオブジェクトを作成します
private AudioManager mAudioManager;
private int mStreamVolume = 0;
onCreateメソッドで次の操作を行います。
mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
音声認識の聞き取りを開始したら、次の操作を行います
speechRecognizer.startListening(intent); // this method make that annoying sound
mStreamVolume = mAudioManager.getStreamVolume(AudioManager.STREAM_MUSIC); // getting system volume into var for later un-muting
mAudioManager.setStreamVolume(AudioManager.STREAM_MUSIC, 0, 0); // setting system volume to zero, muting
Speech RecognitionListenerインターフェイスには、メソッドonReadyForSpeechが必要です。
class MyRecognitionListener implements RecognitionListener
{
public void onReadyForSpeech(Bundle params)
{
// this methods called when Speech Recognition is ready
// also this is the right time to un-mute system volume because the annoying sound played already
mAudioManager.setStreamVolume(AudioManager.STREAM_MUSIC, mStreamVolume, 0); // again setting the system volume back to the original, un-mutting
}
}
この煩わしい音でトリックをプレイする方法は次のとおりです。もちろん、他の音も一瞬ミュートされます。