Android-nRF-Connect icon indicating copy to clipboard operation
Android-nRF-Connect copied to clipboard

Performing DFU using freshly installed app fails because it doesn't trigger Android location permission screen.

Open wvanhed opened this issue 2 years ago • 1 comments

Describe the bug When the user installs the nrf Connect for Mobile App, and immediately performs a DFU to an already bonded device, the DFU update fails with unclear reason. The root cause is that the App doesn't have the correct Location permissions (so it can't scan for the DFU broadcasting peripheral), and the Android Permission pop-up screen is never triggered and shown.

To Reproduce

  1. Bond (via android bluetooth settings) to a target BLE peripheral that supports Nordic DFU firmware updates.
  2. If present, remove the nrf Connect app from the android device
  3. Install (do not open!) the nrf Connect app from the google play store
  4. Open the nrf Connect app.
  5. Go to the tab “Bonded” to see a list of devices
  6. Tap the device you are connected/bonded to. It will open in a new tab
  7. Tap the DFU (Device Firmware Update) icon (top-right)
  8. Choose “zip upgrade package” from the menu that follows
  9. Point the app to the desired image (e.g. on Google Drive or so)
  10. The update will start

Expected behavior A new (DFU) device should appear in a separate tab, and App should - after some time - report that the application was successfully sent to the device.

Actual behavior No new device tab appears. Application is not updated. In the log screen, the message "DFU Bootloader not found. Trying the same address..." appears, followed by a couple of "Error 133: Connection timeout" messages.

Screenshots image

Versions (please complete the following information):

  • Android version: 11
  • Phone model Pixel4a
  • App Version 4.26

Additional context The root cause of the issue was narrowed down to the App not having the required Android "Location" permissions. Normally, when an app needs these permissions, a window will pop-up when this is the case. For example, when you click the "Scan" button under the "Scanner" tab of the nrf Connect app, this Android pop-up will appear when using the app for the first time. However, it seems that the DFU update also needs this permissions (to scan for the DFU bootloader peripheral, I assume), but it does not trigger the permission pop-up.

Workaround: either set the Location permission of the app manually, or first click "Scan" under "Scanner" tab, to trigger the permission pop-up.

Proposed fix: So, I think that clicking the "DFU" icon in the app, should check the app permissions and make sure the permission pop-up message is shown if needed.

wvanhed avatar Dec 15 '22 12:12 wvanhed