Tuesday, February 25, 2014

Detect headset / Bluetooth status

need this permission:
<uses-permission android:name="android.permission.BLUETOOTH"></uses-permission>

and code snap:
                AudioManager audioManager = (AudioManager)context.getSystemService(Context.AUDIO_SERVICE);
                if (audioManager.isWiredHeadsetOn()
                        || audioManager.isBluetoothA2dpOn()
                        || audioManager.isBluetoothScoOn() ) {
      // headset connected
}

No comments:

Post a Comment

Enable HP Zbook Thunderbolt 3 Dock on Ubuntu

As mention in previously post, I installed Ubuntu on my HP ZBook. After two days used all things work just fine, but the Thunderbolt 3 Dock ...