Reputation: 11109
I am using AltBeacon Library and trying to detect beacons. I want to reduce the time between the scan cycles.
mBeaconManager.setBackgroundScanPeriod(30000l);
As per documentation the above line should set the background scan period to 3 seconds. But, i still see that the scan period is 5 mins (300000 ms). Am i missing anything?
Upvotes: 1
Views: 4028
Reputation: 65025
There are actually two method calls:
mBeaconManager.setBackgroundScanPeriod(1100l);
mBeaconManager.setBackgroundBetweenScanPeriod(30000l);
The first call sets how long a bluetooth scan will last, and the second call sets how long there will be between bluetooth scans. The commands above effectively do a 1.1 second scan every 31.1 seconds.
You should generally set the backgroundScanPeriod to 1100 ms or more, because beacons that advertise exactly once per second have a slight chance of being missed if their transmission is always on the boundary of when you start and stop scanning.
Upvotes: 7