Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(android): Clear the gatt cache before discover devices #143

Merged
merged 1 commit into from
Oct 31, 2024

Conversation

kwiky
Copy link
Contributor

@kwiky kwiky commented Oct 31, 2024

Resolve #142

Use of this method is discussed here: http://stackoverflow.com/questions/22596951/how-to-programmatically-force-bluetooth-low-energy-service-discovery-on-android

Basically, some phones cache the list of services and characteristics between connections. So if the device has changed it's services or characteristics since you last connected, you can have fatal errors. The refresh() method will clear the phone's cached list.

Nordic have an implementation here : https://github.com/NordicSemiconductor/Android-BLE-Library/blob/dc46cd3d72d6d5f643c60cdeecc065942143336c/ble/src/main/java/no/nordicsemi/android/ble/BleManagerHandler.java#L1594

@Reedyuk Reedyuk merged commit ec37c4b into Reedyuk:master Oct 31, 2024
2 checks passed
@kwiky kwiky deleted the gatt-cache-refresh branch November 4, 2024 07:48
kwiky added a commit to kwiky/blue-falcon that referenced this pull request Nov 4, 2024
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.

Please add possibility to use hidden method "refresh" on BluetoothGatt
2 participants