What are the differences between the 4 ways to connect a Bluetooth device in Android after scanning?

81 Views Asked by At

I found 4 different ways to connect the Bluetooth device in Android after the scanning:

  1. createBond -> mBluetoothAdapter.getProfileProxy(this, new InputDeviceServiceListener(),BluetoothProfile.INPUT_DEVICE) -> BluetoothInputDevice.connect
  2. createBond -> mBluetoothAdapter.getProfileProxy(this, new BluetoothProfile.ServiceListener(),BluetoothProfile.HID_HOST) -> BluetoothHidHost.connect
  3. createBond -> CachedBluetoothDevice.connect
  4. call BluetoothDevice.connectGatt directly after the scanning

So what's the difference between those 4 ways? Do we have to use different ways to connect for different Bluetooth devices(RCU, Headset, Phone, etc)? Is there one generic way for all kinds of devices?

I have tried to Google these questions without any lock to find an answer. Any comments will be appreciated.

0

There are 0 best solutions below