0

I'm using the reference Altbeacon android app (current) to learn about ibeacons.

I've heard about the "RangedBeacon.setSampleExpirationMilliseconds" value, which defaults to 20 seconds, and the monitor version seems to be 10 seconds by default.

So why do I see refreshed data (RSSI) for all of my iBeacons multiple times a second? This is primarily in the Ranging screen I noticed it scrolling by like mad. I only have 3 beacons.

Does that mean my intervals are set lower than the defaults? Or does this happen somewhere else? Is there some way to slow down the refreshes, and would that help to conserve battery?

TIA!

usernotdev
  • 117
  • 1
  • 7

1 Answers1

1

The Android Beacon Library's RangedBeacon.setSampleExpirationMilliseconds() method has nothing to do with the frequency of the ranging updates. It is used to configure the time interval for averaging distance estimates. The RSSI (Received Signal Strength Indicator) is a measurement of how strong the signal is between the mobile device and the beacon, and is used as an input to estimate distance. Because this measurement is inherently volatile due to radio noise, a running average is used to smooth out this noise. By default, the interval of this running average is 20 seconds. Becasue this default may be inappropriate for applications that need less "lag" in the estimate of distance between the mobile device and the beacon, the library allows it to be configured to be a different period of time.

The default ranging refresh interval is controlled by different scanPeriod and betweenScanPeriod settings, which default to 1.1 seconds, and 0 seconds respectively. The defaults say that the library will scan for 1.1 seconds, then stop scanning for 0 seconds, then start scanning again. You can adjust these defaults by calls to beaconManager.setForegroundScanPeriod(long milliseconds) and beaconManager.setForegroundBetweenScanPeriod(long milliseconds) (there are also background equivalents to these methods for when you app is in the background, which default to 10 and 300 seconds, respectively.)

If you wish to conserve battery, then what you want to do is adjust the betweenScanPeriod to be a longer value. But again, the library already adjust this to be 5 minutes when your app is in the background. You can read more information on this battery saver feature here.

davidgyoung
  • 63,876
  • 14
  • 121
  • 204
  • This is good to know. Obviously, I'm equally concerned by the fact my ibeacons broadcast that often, and I'll see if the specific vendor (Gimbal) supports any way to change their intervals directly. Battery life on those is definitely a concern. – usernotdev Jan 12 '15 at 13:15
  • Be careful about decreasing advertising frequency. Lower frequency beacons will cause poor ranging distance estimates due to fewer statistical samples. And monitored regions will send an exit notification if a beacon is not seen in 3 secs on iOS, 10 secs with the Android Beacon Library. That is why 10 Hz is the general standard. – davidgyoung Jan 12 '15 at 14:26
  • And I presume, if I halve the advertising frequency, I will double the error/failure rate? – usernotdev Jan 13 '15 at 00:36
  • It is true that not 100% of beacon advertisements get received by Android devices. The two main reasons for this are (1) CRC errors caused by radio noise and collisions and (2) the receiver turning on/off its scanner in the middle of the advertisement transmission. Under typical conditions, about 80-90% of packets are received correctly. This is largely random, so you can use statistics to figure out how frequently you need to advertise for achieve a maximum time between received packets for any given confidence interval. – davidgyoung Jan 13 '15 at 01:36