When getting ranging updates from an Eddystone UID with TLM beacon, the updates are not regular even if didRangeBeaconsInRegion() is supposed to be called at every second. I see updates on the log sporadically, even sometimes no update for 8-10 seconds and then again sporadically.
A portion of the log below shows the sporadic nature of D/RangingActivity from the moment the beacon is detected;
D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=7
D/BluetoothAdapter: STATE_ON
D/BluetoothAdapter: STATE_ON
D/BluetoothLeScanner: Stop Scan
D/BluetoothLeScanner: Start Scan
D/BluetoothAdapter: STATE_ON
D/BluetoothAdapter: STATE_ON
D/BluetoothAdapter: STATE_ON
STATE_ON
D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=7
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
I/ScanHelper: Non-distinct packets detected in a single scan. Restarting scans unecessary.
D/RangingActivity: I see a beacon transmitting namespace id: 0x00010203040506070809 and instance id: 0x04514000b000 approximately 16.9709421436514 meters away.
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/RangingActivity: I see a beacon transmitting namespace id: 0x00010203040506070809 and instance id: 0x04514000b000 approximately 37.302382194318774 meters away.
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/RangingActivity: I see a beacon transmitting namespace id: 0x00010203040506070809 and instance id: 0x04514000b000 approximately 31.25429550588763 meters away.
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/RangingActivity: I see a beacon transmitting namespace id: 0x00010203040506070809 and instance id: 0x04514000b000 approximately 28.936042431918796 meters away.
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/RangingActivity: I see a beacon transmitting namespace id: 0x00010203040506070809 and instance id: 0x04514000b000 approximately 26.86915572611937 meters away.
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/RangingActivity: I see a beacon transmitting namespace id: 0x00010203040506070809 and instance id: 0x04514000b000 approximately 18.93489852744025 meters away.
D/RangingActivity: Lux value is 12544 The above beacon is sending telemetry version 0, has been up for : 398 seconds, has a battery level of 3320 mV, and has transmitted 77 advertisements.
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/RangingActivity: I see a beacon transmitting namespace id: 0x00010203040506070809 and instance id: 0x04514000b000 approximately 18.93489852744025 meters away.
D/RangingActivity: Lux value is 12544 The above beacon is sending telemetry version 0, has been up for : 419 seconds, has a battery level of 3320 mV, and has transmitted 81 advertisements.
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/RangingActivity: I see a beacon transmitting namespace id: 0x00010203040506070809 and instance id: 0x04514000b000 approximately 35.47854961599127 meters away.
D/RangingActivity: Lux value is 12544 The above beacon is sending telemetry version 0, has been up for : 449 seconds, has a battery level of 3320 mV, and has transmitted 87 advertisements.
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
My code is the same as described in the following documents:
https://developer.radiusnetworks.com/2015/07/14/building-apps-with-eddystone#
https://altbeacon.github.io/android-beacon-library/eddystone-how-to.html
I have tried with different beacon advertisement periods but the problem remains. Is there any way to get ranging updates regularly i.e. for every second?
Thanks in advance...
I suspect the problem is with Eddystone-TLM frame itself. The telemetry frame is an interleaved frame that is not sent out as often as the UID or primary Eddystone beacon type. Telemetry is only updated when a new TLM frame comes in, which may be rare as you describe. The library’s scan intervals have no control over this — it is just how TLM works and is s function of the hardware’s interleave rate.
Regardless of the above, the library always sends didRangeBeacons callbacks at a regular interval, although the list of detected beacons may be empty if none were detected. Your Eddystone-UID detection rates should be more regular. Try adding more logging in your didRangeBeacons callback including the timestamp and count of beacons to see what is going on.
You might try testing this with an I modified Android Beacon Library to confirm, and look for any differences in your code if necessary.
Adding beaconManager.setDebug(true); can get you internal debug logs.