Disable automatic bonding upon connection



  • If I understand correctly, SweetBlue keeps track of which devices were bonded before and will bond() to them again upon next connection.

    As of now, some of our legacy devices support bonding for OTA updates but not for regular connection. So we want the underlying automatic bonding to be disabled for them.

    We're moving all of our devices to support bonding under all scenarios, but it will take some time and we will still need to support legacy devices.

    I think that setting autoBondFixes, tryBondingWhileDisconnected and tryBondingWhileDisconnected_manageOnDisk to false when we do not support bonding makes the trick.

    Is there anything else we should tweak in order for SweetBlue to connect without bonding?



  • That should do it. Although I think perhaps we should add a method to BleDevice to clear the bond data for the case where your device uses bonding, then after an OTA it doesn't anymore. I'll add it for the next release.



  • Thank you! Any expected timeline for the upcoming release?



  • Soon-ish. :). In all seriousness, there is no planned date yet. Our company just moved its headquarters, so things are in a bit of a disarray at the moment. Our build servers haven't been setup on the network yet. If I were to hazard a guess, I would say not for at least another 2 weeks or so.

    I actually changed how it's going to work, there will be no option to clear the bond flag, however, the manageOnDisk option is now false by default, so it will ignore any flag saved for the device.

    For now, you can also use BleDevice.clearSharedPreferences() to clear all the saved data for the device (as opposed to the user having to uninstall/re-install the app).



  • @ryanbis I see, yeah changing offices can be complicated! We also moved earlier this year and it took some time to get things to run smoothly again.

    By “the bond flag” you mean * autoBondFixes*? I guess it would not be ideal to disable that one by default since bonding does help improve the connection’s reliability overall?

    Using BleDevice.clearSharedPreferences() is interesting, thank you.



  • No, I was referring to tryBondingWhileDisconnected_manageOnDisk. autoBondFixes will remain as it helps phones that aren't so good at reliable connections.



  • Gotcha, sounds great!