Skip to content

Android: char. notifications not working for certain devices (startNotification) #1055

@jampy

Description

@jampy

First of all, a huge "thank you" for this awesome package!

I'm having a problem where startNotification() never calls the success callback on a specific device. It's a BLE bridge to a GPS receiver.

However, notifications work without any problems on the same smartphone when using WebBluetooth in Chrome.

The code used is the same because I pack the cordova-plugin-ble-central API in a WebBluetooth wrapper.

The problematic device offers a typical service 6e400001-b5a3-f393-e0a9-e50e24dcca9e and should continuously deliver data via the characteristic 6e400003-b5a3-f393-e0a9-e50e24dcca9e.

The matching peripheral.characteristics[] entry looks like this:

Image

When I query the characteristic directly with read(), I receive some of the bytes that I should receive via notifications. The UUID should therefore be correct.

Any tips on what I could try to solve the problem?

PS: When talking to different BLE devices (completely different types, like cameras or scales), startNotification() from cordova-plugin-ble-central works without any problems (also with my WebBluetooth wrapper).


Edit: minimal example:

const mac = "F4:65:0B:6F:BA:4E";
const serviceId = "6e400001-b5a3-f393-e0a9-e50e24dcca9e";
const charId = "6e400003-b5a3-f393-e0a9-e50e24dcca9e";

ble.connect(mac, () => console.log("CONNECTED"), err => console.error(err));  
// ...prints "CONNECTED"

ble.startNotification(mac, serviceId, charId, buf => console.log("NOTIFICATION:", buf), err => console.error(err));
// ...no output

ble.read(mac, serviceId, charId, buf => console.log("READ:", buf), err => console.error(err));
// ...prints "READ: ArrayBuffer(348)" on every read() call

Edit2: made clear that notifications work with other BLE devices (not other phones).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions