so I am using an Evothings example on eddystone scanning and for some reason after some time the app won't scan anymore.
Calling function startScan every 500 ms :
function onDeviceReady() {
// Start tracking beacons!
setInterval(function(){ startScan() }, 500);
}
startScan function:
function startScan() {
// console.log("Startscan called"+new Date());
// Called continuously when ranging beacons.
evothings.eddystone.startScan(
function(beacon)
{
console.log("Startscan called evo"+new Date());
// Insert/update beacon table entry.
beacon.timeStamp = Date.now();
beacons[beacon.address] = beacon;
domodalandstuff(); // this function opens a bootstrap modal to show some data
},
function(error)
{
console.log('Eddystone Scan error: ' + JSON.stringify(error)+" "+new Date());
}
)};
After ~10 minutes I see this in my console:
The app just stops calling startScan(), so of course my app won't find beacons anymore.
I guess the problem is "Calling function startScan every 500 ms". Like this you start many scans at once.
You should call it only once. Your startScan function calls evothings.eddystone.startScan which starts and keep scanning until stopped. So you shall call evothings.eddystone.startScan
only once and it will call your successCallback each time beacon is detected.
function onDeviceReady() {
startScan();
}
Note: You should call evothings.eddystone.stopScan
somewhere.