When my code didn't work, I started with the project I found here and ran it against our custom bluetooth device on my moto-x. Against the general attributes with profiles, I get data back from the following code:
public void readCharacteristic(BluetoothGattCharacteristic characteristic) {
if (mBluetoothAdapter == null || mBluetoothGatt == null) {
Log.w(TAG, "BluetoothAdapter not initialized");
return;
}
mBluetoothGatt.readCharacteristic(characteristic);
}
which returns data asynchronously in:
public void onCharacteristicRead(BluetoothGatt gatt,
BluetoothGattCharacteristic characteristic,
int status) {
if (status == BluetoothGatt.GATT_SUCCESS) {
broadcastUpdate(ACTION_DATA_AVAILABLE, characteristic);
}
}
This also works if i run this code against a heart rate monitor.
If I run it against one of our custom properties without a default profile, the data never comes back. Ever.
A google search included this: Cannot read characteristic. Android BLE but setting up notifications did not solve my problem.
Any advice?