title: Android 2.2 progammically tell if my Bluetooth Headset is connected on application start
body: <p>I am programming for android 2.2 API Level 8 and I am trying to find out if there is currently a bluetooth headset connected when my application starts initially.  I can not seem to find a solution to this issue.</p>
  
  <p>Once my application is up and running I can listen for BluetoothDevice.ACTION_ACL_CONNECTED and BluetoothDevice.ACTION_ACL_DISCONNECTED as denoted <a href="https://stackoverflow.com/questions/4715865/how-to-programmatically-tell-if-a-bluetooth-device-is-connected-android-2-2">here</a> which works great mind you.  But I can't figure out how to tell before the BroadcastReceiver is on if there is currently a bluetooth headset connected.</p>
  
  <p>I have also figured out how to see if the device has any paired devices via the following. </p>
  
  <pre><code>BluetoothAdapter mBluetoothAdapter = null;
  mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
  if(mBluetoothAdapter != null)
  {
      Set&lt;BluetoothDevice&gt; pairedDevices = mBluetoothAdapter.getBondedDevices();
      if (pairedDevices.size() != 0)
      {
          // the device has paired devices
          for (BluetoothDevice device : pairedDevices)
          {
              Log.i(TAG, "device name: " + device.getName());
              Log.i(TAG, "device address: " + device.getAddress());
          }
      }
      else
      {
          // no paired devices
          Log.i(TAG, "no paired devices");
      }
  }
  </code></pre>
  
  <p>I am hoping that someone out there already has a solution to this issue for API Level 8.  I do realize that in API 11 there are some new classes such as 
  <a href="http://developer.android.com/reference/android/bluetooth/BluetoothHeadset.html" rel="nofollow noreferrer">BluetoothProfile</a> and 
  <a href="http://developer.android.com/reference/android/bluetooth/BluetoothProfile.html" rel="nofollow noreferrer">BluetoothHeadset</a> that could probably do this in 1 line of code, but again I am trying to do this in API Level 8</p>
  
  <p>I am willing to try anything at this point.</p>
  
  <p>Thanks in advance</p>
  
  <p>-H</p>