开发者

AudioManager.isWiredHeadsetOn() is not working in android

I want to check whether heaset is plugged in or not... I did it like this

 AudioManager am = (AudioManager)getSystemService(AUDIO_SERVICE);
 Log.i("am.isWiredHeadsetOn()", am.isWiredHeadsetOn()+"");

But i am always getting false value...

Why is开发者_StackOverflow社区 this happening?


It looks like this is a bug. You will always get false when calling isWiredHeadsetOn unless your add MODIFY_AUDIO_SETTINGS permission to AndroidManifest.xml:

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜