且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Android的耳机检测

更新时间:2023-11-18 12:25:40

有一个广播制作时,插入耳机:的http://developer.android.com/reference/android/content/Intent.html#ACTION_HEADSET_PLUG

There is a broadcast made when the headphones are plugged in: http://developer.android.com/reference/android/content/Intent.html#ACTION_HEADSET_PLUG

您需要注册一个广播接收器来接受这一点,并执行您所需的操作。

You need to register a BroadcastReceiver to receive this and perform your required actions.