3
votes

I want to pair my Android cellphone with a BLE device using createBond and setPin as in this StackOverflow question.

I'm using a TI SensorTag, and I am able to get it to connect, but I want to get it to bond so that I don't have to scan for it later.

Unfortunately, when I use createBond (or when I try to pair through Android Bluetooth Settings), my phone wants a PIN. I have not been able to find the PIN online, and some people I've asked say that BLE devices can't bond (that they only use the Just Works method). Does anyone know the SensorTag PIN, where to find it, or whether I'm just completely off base?

4
No as per my knowledge you can not Bond bluetooth low energy device as it works on profile mechanism. Not like traditional core bluetooth devices.user370305
Let me know if you find any additional info. Thanks.user370305
According to nordic, you can definitely bond BLE devicesZatricion
@Zatricion, your link is dead. Do you have an alternate link?Mike Holler
@MikeHoller I don't know if this is the same link, but it is all I could find. devzone.nordicsemi.com/documentation/nrf51/5.2.0/html/…Zatricion

4 Answers

1
votes

Android notwithstanding, BLE is a branch of Bluetooth 4.0 and, as such, should supporting pairing and bonding.

Technically, the "Just Works" method still implies bonding. However, in my experience it isn't necessary for both Android and iOS devices to connect and read from BLE devices that have authentication disabled.

1
votes

My experience with the TI SensorTag data using Android is that it does not bond. The TI SensorTag uses the Just Works BLE method.

This is the sequence I use to communicate with the TI SensorTag, based on the information in http://developer.android.com/guide/topics/connectivity/bluetooth-le.html

  1. press the button on the SensorTag. This will cause it to listen for Scan requests.
  2. call startLeScan(). Wait for callback.
  3. in your onLeScan() callback, save the device of the discovered TISensorTag.
  4. On the UI thread, call device.connectGatt() and wait for callback.
  5. In your onConnectionStateChange(), call discoverServices() and wait for callback.
  6. In your onServicesDiscovered(), notify your UI thread that you are connected.
  7. In your UI thread, start a read of a GATT Characteristic with readCharacteristic(). Wait for callback.
  8. In your onCharacteristicRead(), call one of the getValue() methods.
  9. Call BluetoothGatt.close(). This call is important. If your app exits without calling close(), the Bluetooth Stack may become unusable and you will need to reboot your phone.
1
votes

I make my phone bonded to 2540 peripheral, and the PIN is 00000000,eight 0s;I am not sure if it works on TI sensor Tag, you can try. And I also have a question, how I use A bonded device.

0
votes

I was able to bond the SensorTag with 000000 as PIN.