I\'m trying to implement simple sdk for working with fitness tracker Xiaomi Mi Band. Currently I can track steps, actuate the vibration, handle the sensor touch but I have a pro
Im working with BLE A&D , to obatin the iformation i use:
To find UUID
@SuppressLint("NewApi")
private void displayGattServicesService(List gattServices) {
// salida.append("Buscando servicio");
if (gattServices == null)
return;
for (BluetoothGattService gattService : gattServices) {
String uuid = gattService.getUuid().toString();
List gattCharacteristics = gattService
.getCharacteristics();
if (uuid.equals("00001810-0000-1000-8000-00805f9b34fb")) {
// salida.append("Ecnontro");
for (BluetoothGattCharacteristic gattCharacteristic : gattCharacteristics) {
String uuid1 = gattCharacteristic.getUuid().toString();
if (uuid1.equals("00002a35-0000-1000-8000-00805f9b34fb")) {
// salida.append("Envio caracterisitca");
mensaje(getResources().getString(R.string.Espere_res));
mBluetoothLeService.setCharacteristicNotification(
gattCharacteristic, true);
}
}
}
}
}
To set UUID
BluetoothLeService.ACTION_GATT_SERVICES_DISCOVERED.equals(action)) {
// Show all the supported services and characteristics on the user interface.
displayGattServicesService(mBluetoothLeService.getSupportedGattServices());
Use BleGatt Example https://github.com/googlesamples/android-BluetoothLeGatt