Reputation: 43
I deployed 9 iBeacons in the experimental environment. Detecting regional iBeacons using by:
public void onBeaconServiceConnect() {
beaconManager.setRangeNotifier(new RangeNotifier() {
@Override
public void didRangeBeaconsInRegion(Collection<Beacon> beacons, Region region) {
System.out.println("The number of iBeacons detected = "+beacons.size());
}
});
try {
beaconManager.startRangingBeaconsInRegion(new Region("myRangingUniqueId", null, null, null));
} catch (RemoteException e) {
}
}
Output by:
I/System.out: The number of iBeacons detected = 2
I/System.out: The number of iBeacons detected = 4
I/System.out: The number of iBeacons detected = 8
I/System.out: The number of iBeacons detected = 7
I/System.out: The number of iBeacons detected = 9
I/System.out: The number of iBeacons detected = 4
I/System.out: The number of iBeacons detected = 4
I/System.out: The number of iBeacons detected = 5
I/System.out: The number of iBeacons detected = 6
I/System.out: The number of iBeacons detected = 3
I/System.out: The number of iBeacons detected = 6
I/System.out: The number of iBeacons detected = 2
I/System.out: The number of iBeacons detected = 7
I/System.out: The number of iBeacons detected = 7
I confirm that every iBeacon has normal operation. How to make all iBeacon information for each detection?
Upvotes: 2
Views: 44
Reputation: 65025
I suspect your beacons are not advertising frequently enough for reliable detections.
Each beacon manufacturer has a different default advertising rate -- how often packets are sent out. The iBeacon standard requires 10 Hz (10 packets per second) but many manufacturers of battery powered beacons reduce this to 1 Hz (1 packet per second) to save battery.
The problem is that not 100% of packets get detected even in the best conditions, which is one of the reasons Apple specifies a transmission rate of 10x the normal ranging rate of once per second to make detections reliable.
To fix this, do one of two things:
beaconManager.setForegroundScanPeriod(10000);
Upvotes: 1