Search code examples
altbeacon

Change beacon sending frequency in AltBeacon


I am using the AltBeacon API to send beacons in an Android app. I am using the startRangingBeacon method with the deafult region as an argument - region = Region("all-beacons", null, null, null).

I know that beacons are sent with the frequency of 1 second. Is it possible to change this frequency?

I tried to search for a frequency variable in the BeaconManager but could not find one.


Solution

  • Simply call:

    beaconManager.scanPeriod = 2000L // set callback to 2000ms instead of the default 1100ms

    Be aware that increasing the frequency of callbacks will sometimes mean you don’t get detections, as some beacons do not advertise more frequently than once per second. If no detections are made, the callback will have a beacon count of zero.