BLE module discover beacon only once


#1

Hi,
I’m creating simple application to discover beacons nearby me.
I’m using this plugin https://github.com/don/cordova-plugin-ble-central to handle BLE.
There are two methods:
ble.startScan(services, success, failure);
ble.startScanWithOptions(services, options, success, failure);

When I use ble.startScan I can only discover beacon once. Even when I turn off/on beacon, application didn’t “discover” beacon again.
ble.startScanWithOption have got flag reportDuplicates and when I enable this flag I can see that beacon is discovered again and again.

My question is how to detect beacon once and monitor if it is still in my range? It is possible to check for eg. every 5 sec if I’m still in beacon range?


#2

Are you using https://ionicframework.com/docs/native/ble/?


#3

Yes, I’m using https://ionicframework.com/docs/native/ble


#4

Then the methods are different:
https://ionicframework.com/docs/native/ble/#startScan
https://ionicframework.com/docs/native/ble/#startScanWithOptions

For you actual problem I unfortunately have no idea.


#5

I’m wonder what should I do to https://ionicframework.com/docs/native/ble/#startScan discover the same device again.


#6

Hi,
Clear your array with discovered devices and re-run the scan function on button press


#7

This plugin isn’t intended for scanning beacons. Try cordova-plugin-ibeacon for iBeacons.