1

我注意到,在我的智能手机上,当我断开耳机与手机的连接时,许多内置应用程序的音频播放都会停止。您如何以编程方式设置它,或者这是 android 设备上的标准。

4

1 回答 1

1

1.Use Broadcast receiver. Add Intent Filter (Intent.ACTION_HEADSET_PLUG).

The intent will have the following extra values:

state - 0 for unplugged, 1 for plugged. name - Headset type, human readable string microphone - 1 if headset has a microphone, 0 otherwise

  1. From the onRecive() method you can control the Audio playback.
于 2013-06-05T15:24:27.637 回答