I have developed an app that connect to a Polar heart monitor. I connect to it using : device.connectGatt(this, false, mGattCallback); and If I lost the connection I rescan the device and I reconnect to the same hear monitor.
I wonder if I can obtain this behaviours with using :
device.connectGatt(this, true, mGattCallback);
Without re scan the device.
Which is the better way ?
This isn't possible as of now. The peripheral doesn't take the initiative in establishing a connection once again after it bonds with a device. The central should poll and discover the peripherals presence. This is the architecture of BLE and it's designed in such a way to conserve energy on the peripheral.
Ref: http://www.amazon.com/Inside-Bluetooth-Energy-Artech-Communications/dp/1608075796
Note: This might change if devices start implementing BLE 4.1 and 4.2 standards.