Code example for BluetoothHeadset
mBluetoothHeadset = (BluetoothHeadset) proxy;
// If a headset is connected before this application starts,
// ACTION_CONNECTION_STATE_CHANGED will not be broadcast.
// So we need to check for already connected headset.
List<BluetoothDevice> devices = mBluetoothHeadset.getConnectedDevices();
if (devices.size() > 0)
// Only one headset can be connected at a time,
// so the connected headset is at index 0.
mConnectedHeadset = devices.get(0);
// Should not need count down timer, but just in case.
// See comment below in mHeadsetBroadcastReceiver onReceive()
mIsCountDownOn = true;
Log.d(TAG, "Start count down"); //$NON-NLS-1$