Add legacy scan parameter on Android#260
Conversation
There was a problem hiding this comment.
Code Review
This pull request removes the forced setLegacy(false) and setPhy configurations on Android SDK >= 26 to allow legacy BLE 4.x advertisements to be discovered by default, alongside updating the version to 2.0.5. The reviewer points out that removing setLegacy(false) entirely introduces a regression where BLE 5.0 extended advertisements can no longer be scanned. They suggest making this setting configurable via androidConfig to support both legacy and extended advertisements.
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.
There was a problem hiding this comment.
Pull request overview
This PR adjusts Android BLE scanning behavior to once again include legacy BLE 4.x advertisements (commonly used by ESP32 devices) by no longer forcing Android’s scan settings into non-legacy/extended mode.
Changes:
- Bump package version to 2.0.5.
- Add a 2.0.5 changelog entry describing the Android scan behavior change.
- Android: remove the API 26+ forced
setLegacy(false)andsetPhy(...)scan settings so Android uses its default (legacy) scan behavior.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| pubspec.yaml | Version bump to 2.0.5 to publish the behavior change. |
| CHANGELOG.md | Documents the Android scan settings change in 2.0.5. |
| android/src/main/kotlin/com/navideck/universal_ble/UniversalBlePlugin.kt | Stops forcing non-legacy/PHY scan settings so legacy BLE 4.x advertisements are returned again. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
b1575df to
539145e
Compare
Android now has a
legacyparameter for scan which can be set totrueso that legacy BLE 4.x advertisements can be discovered.