don/cordova-plugin-ble-central

Android stopNotification causes errors if done too quickly

sam-higgs opened this issue · 3 comments

Upon calling .stopNotification() an error occurs when trying to do any other ble action too quickly afterwards e.g. .startNotification() or .read()

Has anyone else experienced this? Adding a delay of over 100ms seems to be a workaround.

Hi @sam-higgs

Are you able to provide any logs with what the reported errors are?

Generally speaking, you should wait for the callbacks to complete (or await the ble.withPromises.stopNotification(...) promise) before starting another notification or reading another value.

Out of interest, what's the use-case here that's requiring you to stop and then start the notifications in quick succession?