code: @SuppressWarnings("deprecation")
      private boolean startBluetooth() {
          Log.d(TAG, "startBluetooth");
  
          // Device support bluetooth
          if (mBluetoothAdapter != null) {
              if (mAudioManager.isBluetoothScoAvailableOffCall()) {
                  mContext.registerReceiver(mBroadcastReceiver,
                          new IntentFilter(BluetoothDevice.ACTION_ACL_CONNECTED));
                  mContext.registerReceiver(mBroadcastReceiver,
                          new IntentFilter(BluetoothDevice.ACTION_ACL_DISCONNECTED));
                  mContext.registerReceiver(mBroadcastReceiver,
                          new IntentFilter(AudioManager.ACTION_SCO_AUDIO_STATE_CHANGED));
  
                  // Need to set audio mode to MODE_IN_CALL for call to startBluetoothSco() to succeed.
                  mAudioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
  
                  mIsCountDownOn = true;
                  // mCountDown repeatedly tries to start bluetooth Sco audio connection.
                  mCountDown.start();
  
                  // need for audio sco, see mBroadcastReceiver
                  mIsStarting = true;
  
                  return true;
              }
          }
  
          return false;
      }
docs: Register for bluetooth headset connection states and Sco audio states.
  Try to connect to bluetooth headset audio by calling startBluetoothSco().
  This is a work around for API < 11 to detect if a headset is connected before
  the application starts.
  <p/>
  The official documentation for startBluetoothSco() states
  <p/>
  "This method can be used by applications wanting to send and received audio to/from
  a bluetooth SCO headset while the phone is not in call."
  <p/>
  Does this mean that startBluetoothSco() would fail if the connected bluetooth device
  is not a headset?
  <p/>
  Thus if a call to startBluetoothSco() is successful, i.e mBroadcastReceiver will receive
  an ACTION_SCO_AUDIO_STATE_CHANGED with intent extra SCO_AUDIO_STATE_CONNECTED, then
  we assume that a headset is connected.
  
  @return false if device does not support bluetooth or current platform does not supports
  use of SCO for off call.