Skip to content

Fix missing scan name on Android#252

Merged
fotiDim merged 3 commits into
mainfrom
Fix-missing-scan-name-on-Android
Jun 5, 2026
Merged

Fix missing scan name on Android#252
fotiDim merged 3 commits into
mainfrom
Fix-missing-scan-name-on-Android

Conversation

@fotiDim

@fotiDim fotiDim commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Fixes #251

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a resolvedDeviceName extension property on ScanResult to resolve the device name from the scan record, falling back to the device name if unavailable, and updates UniversalBlePlugin to use it. The review feedback correctly identifies a potential SecurityException crash on Android 12+ when accessing device.name without the BLUETOOTH_CONNECT permission, and suggests wrapping the call in a try-catch block.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes an Android-only scanning regression where a device’s display name becomes missing (e.g., “N/A”) after a connect/disconnect cycle, by preferring the advertised local name from the scan record over the cached BluetoothDevice.name.

Changes:

  • Add ScanResult.resolvedDeviceName that resolves the scan name as scanRecord.deviceName (when non-blank) falling back to device.name (guarded against SecurityException).
  • Update Android scan callback to use the resolved name for both filtering and the emitted UniversalBleScanResult.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
android/src/main/kotlin/com/navideck/universal_ble/UniversalBlePlugin.kt Uses result.resolvedDeviceName in onScanResult to emit a stable scan name post-GATT.
android/src/main/kotlin/com/navideck/universal_ble/UniversalBleHelper.kt Introduces ScanResult.resolvedDeviceName to prioritize advertised name and safely fall back to device.name.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@fotiDim fotiDim force-pushed the Fix-missing-scan-name-on-Android branch from bc84768 to b94a92c Compare June 4, 2026 18:07
@fotiDim fotiDim merged commit aef1cd4 into main Jun 5, 2026
2 checks passed
@fotiDim fotiDim deleted the Fix-missing-scan-name-on-Android branch June 5, 2026 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Android][Urgent] Scan name missing (N/A) after connect/disconnect with BLE device

3 participants