setMicrophoneMute(布尔)不会在某些设备上工作 [英] setMicrophoneMute(boolean) doesn't work on some devices

查看:275
本文介绍了setMicrophoneMute(布尔)不会在某些设备上工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我找不到任何这里有关的职位(但在互联网上的其他小职位),所以这里是:

I couldn't find any related post here (but other small posts on the internet), so here it is:

AudioManager.setMicrophoneMute(布尔)不会做,我用测试了一些特殊的设备什么:谷歌Nexus S,三星Galaxy S和摩托罗拉里程碑。 在任何其他设备效果很好。

AudioManager.setMicrophoneMute(boolean) doesn't do anything on some particular devices that I tested with: Google Nexus S, Samsung Galaxy S and Motorola Milestone. On any other device it works well.

它甚至保持其状态,并返回一个布尔值,如果它得到了静音\静音,但它没有静音 - 麦克风继续记录 - 无论是在GSM通话和AudioRecord计划录制。 没有指示日志消息。

It even maintains its "state" and returns a boolean as if it got muted\unmuted, but it doesn't mute - microphone continues to record - both in GSM call and in AudioRecord programmatic recording. There is no indicative log message.

我也搞砸权限(android.permission.MODIFY_AUDIO_SETTINGS,android.permission.RECORD_AUDIO),没有什么新意。

I also messed with permissions (android.permission.MODIFY_AUDIO_SETTINGS, android.permission.RECORD_AUDIO), nothing new here.

有没有其他人遇到?有没有人有一种变通方法或神奇的解决方案? 如果我使用AudioRecord我只是实现自己的静音这些设备 - 我不会把所记录的缓冲区。但它不能帮我带静音麦克风在GSM通话,这是我所需要的。

Did anyone else encounter that? Does anyone have a workaround or a magic solution? If I use AudioRecord I just implement my own "mute" for these devices - I don't pass on the recorded buffers. But it can't help me with muting the mic in a GSM call, which I need.

感谢

----------------更新----------------

---------------- Update ----------------

请参阅下文。

推荐答案

我有同样的问题,我想模拟来电屏幕。 而且画面内的按钮进行静音和AudioManager.setMicrophoneMute(布尔)工作在大多数手机上,但不是所有的人。我发现了一个办法来解决它。我模拟上的免提静音按钮preSS。它的工作对我来说希望这将有助于你太 这里是code:

Hi i had the same problem i wanted to simulate incoming call screen. and within that screen a button that perform mute, and the AudioManager.setMicrophoneMute(boolean) worked on most phones but not on all of them. i found a way to get around it. i simulate a press on mute button on the handsfree kit . it worked for me hope it will help you too here is the code:

Intent buttonUp = new Intent(Intent.ACTION_MEDIA_BUTTON);
buttonUp.putExtra(Intent.EXTRA_KEY_EVENT,new KeyEvent(KeyEvent.ACTION_UP,KeyEvent.KEYCODE_HEADSETHOOK));
getBaseContext().sendOrderedBroadcast(buttonUp,"android.permission.CALL_PRIVILEGED");

这篇关于setMicrophoneMute(布尔)不会在某些设备上工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆