st0nedB / rooms

With "Rooms" mobile devices can perform indoor self-localization using an app and low-cost BLE beacons.
MIT License
64 stars 7 forks source link

Beacon ranging does not work when re entering zone #15

Closed GaoMax closed 3 years ago

GaoMax commented 3 years ago

Describe the bug If one reenters the beacon zone, after leaving it, the function locationManager(_ manager: CLLocationManager, didEnterRegion region: CLRegion) gets called, but predictions are not started.

To Reproduce Leave zone, re enter zone Expected behavior Ranging should start when re entering zone

st0nedB commented 3 years ago

That one was always particularly difficult to debug. Most of the time I saw it working during tests, and then randomly in practice. According to Apple docs the mechanism should wake up the app when it detects any of the specified beacons in range. I suspect that it is an issue with exactly that, meaning the CLLocationManager is not properly detecting the beacons and waking up the app.

GaoMax commented 3 years ago

This is actually working for me. I added Local Notifications for Debugging and leaving and re entering works for me. But ranging doesn’t get continued even though startPrediction is called. The App notices when the beacon region is entered and calls beacon ranging exactly one time. Afterwards it stops working.

GaoMax commented 3 years ago

iOS 14.5 Beta 7 seems to have fixed the problem. I am investigating, but the app started by it self upon entering the beacon zone and ranging is working.

st0nedB commented 3 years ago

Okay, I will close this issue for now. Please feel free to reopen in case the issue re-surfaces.

GaoMax commented 3 years ago

This issue still persists and I haven't found a way to prevent it. With my local notification setup I can debug that leaving and entering the region works. Upon entering it does find beacons and updates the room 1-3 times, but dies afterwards. (I'm not connected to wifi when entering the region, might MQTT be the problem?) On iOS 14.5 Beta 7 it did work twice, but I wasn't able to reproduce this.