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

Bluetooth reconnect fix android15 #1463

Merged
merged 5 commits into from
Dec 18, 2024

Conversation

tavdog
Copy link
Contributor

@tavdog tavdog commented Dec 13, 2024

This pull fixes two issues.

  1. The necessity to click None before manually selecting a reconnect from the BT device popup.
  2. The prolonged disconnection non-reconnect behaviour is fixed by trapping BT disconnect code 147 and calling lostConnection() function. This sets up a reconnect attempt loop every 30 seconds. This might be power draining. Could add a user preference somewhere to do this or not. Built apk is available here for testing : https://wildc.net/tmp/meshtastic-fdroid-debug.apk

If we trap code 147 on BT disconnect and then call lostConnection(), the app will attempt reconnect every 30 seconds and autoreconnect works even after prolonged disconnect.
@Franselbaer
Copy link

Thank you. Perhaps a on/off button and/or reconnect timeout set (30 sec - 300 sec) would be a good idea. Great work.

@tavdog
Copy link
Contributor Author

tavdog commented Dec 14, 2024

I just tested these changes on a Pixel 3 - Android 12 - API 31 and it doesn't effect its ability to reconnect.
I'll be doing a battery test tonight to see if the new changes drain the battery noticeably.

@@ -259,7 +259,7 @@ class RadioInterfaceService @Inject constructor(
* @return true if the device changed, false if no change
*/
private fun setBondedDeviceAddress(address: String?): Boolean {
return if (getBondedDeviceAddress() == address && isStarted) {
return if (getBondedDeviceAddress() == address && isStarted && isConnected) {
Copy link
Member

Choose a reason for hiding this comment

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

This is intended behavior. We specifically track isStarted just for this call. Please revert this change, and it should be good to merge.

@andrekir andrekir merged commit 1f0092b into meshtastic:master Dec 18, 2024
5 checks passed
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.

3 participants