Coming from an iOS dev background, when working with Bluetooth LE acting as a peripheral you can register for a callback when a "central" BLE device subscribes (enables notifications) for a characteristic.
I'm struggling to see how this is achieved on Android. If you're working with Bluetooth LE acting as the central, I can see how you'd subscribe:
bluetoothGatt.setCharacteristicNotification(characteristicToSubscribeTo, true);
Which is the same as this on iOS:
peripheralDevice.setNotifyValue(true, forCharacteristic characteristicToSubscribeTo)
Now, after calling the above on iOS, on the peripheral side you then get a callback to say the central has subscribed with a method similar to:
peripheralManager(manager, central subscribedCentral didSubscribeToCharacteristic characteristic)
which then gives you a reference to the device that subscribed/enabled notifications and to what characteristic.
What's the equivalent on Android?
For clarity I'll point out that I don't need to subscribe to a characteristic on Android, the device is acting as the peripheral and needs to be notified when other devices subscribe to characteristics.
Sorry if this is obvious but I can't find it in the docs or elsewhere.
BluetoothGattCallback.onCharacteristicChanged()
? developer.android.com/reference/android/bluetooth/…, android.bluetooth.BluetoothGattCharacteristic) – josemigallas