Communicating between iOS and Android with Bluetooth LE

I’ve already gone through this for at least one week having this same issue. I’ve already asked a question here and I’ve already answered on my own. The main problem is an Android BUG issue. It’s sending a non permitted command on a fixed L2CAP channnel. But when Android is communicating with normal peripheral BLE … Read more

Is there any way to use Bluetooth LE from a c# desktop app in windows 10?

You can use C# APIs in C# Desktop applications! I have a sample here in GitHub. In general, to get access to the C# APIS, add two references to your project: C:\Program Files (x86)\Windows Kits\10\UnionMetadata\Windows.winmd C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETCore\v4.5\System.Runtime.WindowsRuntime.dll Note that the #2 version depends on the version of .NET that you’re using. Background tasks … Read more

Android BLE BluetoothGatt.writeDescriptor() return sometimes false

The documentation lacks information. However you can read the source code to find out the rules, which (currently) are the following: For each BluetoothGatt object, you can only have one outstanding request at a time, including requestMtu, readCharacteristic, writeCharacteristic, readDescriptor, writeDescriptor and executeReliableWrite. So if you issue a read request you need to wait for … Read more

Get MAC address of bluetooth low energy peripheral in iOS

CBPeripheral’s identifier property will serve your purpose, available from a still-unconnected device in CBCentralManager’s didDiscoverPeripheral delegate method: – (void)centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeripheral *)peripheral advertisementData:(NSDictionary *)advertisementData RSSI:(NSNumber *)RSSI CBPeripheral *peripheral … NSUUID* serverId = [peripheral identifier]; I have a half dozen LE devices I’m experimenting with, including multiple sets of identical devices. I just confirmed that across … Read more

Which correct flag of autoConnect in connectGatt of BLE?

“Direct connect” is the opposite to “auto connect”, so if you set the autoConnect parameter to false you get a “direct connect”. Note that doing a “mBluetoothGatt.connect()” will also use auto connect. Beware of https://code.google.com/p/android/issues/detail?id=69834 which is a bug affecting older versions of Android which might make your auto connections to be direct connections instead. … Read more

Find all Bluetooth devices (headsets, phones etc) nearby, without forcing the devices in discoverable mode

So, here’s all I found after reading blogs, threads, documentations, SO answers etc. regarding Android’s bluetooth discovery. Thought this might be useful to post my findings here. So before someone starts reading, I want to clarify that, I could not find any way to detect a bluetooth device nearby which is turned on but not … Read more

How to get the battery level after connect to the BLE device?

I have solved this problem. public class BluetoothLeService extends Service { private static final UUID Battery_Service_UUID = UUID.fromString(“0000180F-0000-1000-8000-00805f9b34fb”); private static final UUID Battery_Level_UUID = UUID.fromString(“00002a19-0000-1000-8000-00805f9b34fb”); public void onCharacteristicRead(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) { if(status == BluetoothGatt.GATT_SUCCESS) { broadcastUpdate(ACTION_DATA_AVAILABLE, characteristic); } } private void broadcastUpdate(final String action, final BluetoothGattCharacteristic characteristic) { final Intent intent = … Read more