capacitor-community / bluetooth-le

Capacitor plugin for Bluetooth Low Energy
MIT License
274 stars 79 forks source link

Notifications not working on some Android devices #673

Open wijzijnweb opened 1 month ago

wijzijnweb commented 1 month ago

Describe the bug On some android devices we are not receiving notifications. Samsung not working, but OnePlus is working and iOS also working

Our code:

await BleClient.initialize({ androidNeverForLocation: true });
await BleClient.isEnabled();

device.value = await BleClient.requestDevice({
    namePrefix: 'MUGSHOTT_',
    services: [UART_SERVICE]
});

await BleClient.connect(device.value.deviceId, (deviceId: string) => onDisconnect(deviceId));
console.log('connected to device', device.value);

await BleClient.startNotifications(
    device.value.deviceId,
    UART_SERVICE,
    UART_TX_CHAR_UUID_CMD,
    (value: DataView) => {
         console.log(value)
})

On the devices that it won't work we receive a uuid of 00000000-0000-0000-0000-000000000000 on the requestDevice call. Anyone has some clue why this happens?

It's for a custom build device, could be the device?