Description
When Bluetooth device discovery fails to even start, the app tells the user nothing and gets stuck
showing "Scanning for devices…" over an empty list, forever. There is no way for the user to
learn what is wrong, because the cause is never surfaced.
Internal support ticket: https://odoo.lutraconsulting.co.uk/odoo/all-tickets/16924
2026-08-26T13:21:42.435Z Bluetooth discovery: Error occured during device discovery, error code #6
2026-08-26T13:21:42.436Z Bluetooth discovery: Started discovering devices, method 3
Environment
Production
Application (+ app version, build, operating system)
- Mergin Maps mobile 2026.3.2 (839651)
- Android-specific
Probably, it only became reachable in practice once Qt 6 added
Steps to reproduce
- Bluetooth switched on. At least one discoverable Bluetooth device nearby.
- Open Mergin Maps and grant the Nearby devices permission when prompted (this is
BLUETOOTH_SCAN + BLUETOOTH_CONNECT - it must be granted, otherwise you hit the separate,
correctly-handled "Bluetooth permission is required" branch.
- Now turn location off, either way round - both produce error
#6:
- a) System Location master switch off - Settings → Location → Use location
- b) Settings → Apps → Mergin Maps → Permissions → Location → Don't allow
- In the app: Settings → Manage GPS receivers → Connect new receiver → Bluetooth.
Actual results
Empty device list with "Scanning for devices…" spinning indefinitely. No message, no hint that location is involved, even after the user fixes the location setting and returns to the screen - the model still believes it is discovering, so nothing restarts it.
The log contains error code #6 and nothing else actionable.
Expected results
The drawer stops the spinner and tells the user what to do - for error #6. Retrying after the user fixes the setting should work without reopening the app.
The log could carry errorString() so support can distinguish "location permission not granted" from "location service turned off" without a round trip to the customer.
Extra debug info
Three separate defects combine here:
- The discovery error never reaches QML.
BluetoothDiscoveryModel has no error signal — the errorOccurred handler only writes to the log (app/bluetoothdiscoverymodel.cpp:28-32). The drawer therefore cannot say anything.
- The model gets stuck in
discovering == true. On Android the error is delivered synchronously from inside QBluetoothDeviceDiscoveryAgent::start(), and setDiscovering() assigns mDiscovering only after start() returns (app/bluetoothdiscoverymodel.cpp:102-121). The re-entrant finishedDiscovery() hits the mDiscovering == discovering early-return and does nothing; the outer call then sets mDiscovering = true. The footer spinner (app/qml/gps/MMBluetoothProviderDrawer.qml:78) never goes away.
- The log throws away the one piece of information support needs. We log the numeric code but not
errorString() (app/bluetoothdiscoverymodel.cpp:30). Error #6(LocationServiceTurnedOffError) has two distinct causes in Qt's Android backend — location permission not granted, and the device-wide location service being off — and the code alone cannot tell them apart.
Description
When Bluetooth device discovery fails to even start, the app tells the user nothing and gets stuck
showing "Scanning for devices…" over an empty list, forever. There is no way for the user to
learn what is wrong, because the cause is never surfaced.
Internal support ticket: https://odoo.lutraconsulting.co.uk/odoo/all-tickets/16924
Environment
Production
Application (+ app version, build, operating system)
Probably, it only became reachable in practice once Qt 6 added
Steps to reproduce
BLUETOOTH_SCAN+BLUETOOTH_CONNECT- it must be granted, otherwise you hit the separate,correctly-handled "Bluetooth permission is required" branch.
#6:Actual results
Empty device list with "Scanning for devices…" spinning indefinitely. No message, no hint that location is involved, even after the user fixes the location setting and returns to the screen - the model still believes it is discovering, so nothing restarts it.
The log contains
error code #6and nothing else actionable.Expected results
The drawer stops the spinner and tells the user what to do - for error
#6. Retrying after the user fixes the setting should work without reopening the app.The log could carry
errorString()so support can distinguish "location permission not granted" from "location service turned off" without a round trip to the customer.Extra debug info
Three separate defects combine here:
BluetoothDiscoveryModelhas no error signal — theerrorOccurredhandler only writes to the log (app/bluetoothdiscoverymodel.cpp:28-32). The drawer therefore cannot say anything.discovering == true. On Android the error is delivered synchronously from insideQBluetoothDeviceDiscoveryAgent::start(), andsetDiscovering()assignsmDiscoveringonly afterstart()returns (app/bluetoothdiscoverymodel.cpp:102-121). The re-entrantfinishedDiscovery()hits themDiscovering == discoveringearly-return and does nothing; the outer call then setsmDiscovering = true. The footer spinner (app/qml/gps/MMBluetoothProviderDrawer.qml:78) never goes away.errorString()(app/bluetoothdiscoverymodel.cpp:30). Error#6(LocationServiceTurnedOffError) has two distinct causes in Qt's Android backend — location permission not granted, and the device-wide location service being off — and the code alone cannot tell them apart.