Unbond behavior on App termination

  • Hi, is there any implicit or explicit call to the unbond() method when the BleManager or other component is closed upon App being terminated?

    I'm experiencing an issue where the OS is showing up a "Pair" popup when the app is closed, opened again and a connection to a device that is already paired is attempted.

    Any help is welcomed, thanks!

  • @AlejandroHCruz ,

    Well, it should never do anything once the app is terminated. However, some phones are terrible with bonding, and in fact once fix for getting more consistent connections is to unbond when you disconnect the device (so it gets a new bond on each connect). This is typically done on Sony's and Motorolas. You can shut this behavior off by setting BleManagerConfig.autoBondFixes to false.

  • Hi @ryanbis,

    A bit more context, so maybe we can figure out a solution together: I saw this behavior on a Sony, Google Pixel, Vivo & Huawei phones. They all already had the autoBondFixes set to false, also the tryBondingWhileDisconnected & tryBondingWhileDisconnected_manageOnDisk had been set to false beforehand. I disable this by calling BleDevice.setConfig(BleDeviceConfig) with a custom BleDeviceConfig object before calling connect().

    This issue does not happen with our iOS app, when connecting to the same custom Bluetooth device.

    Could it be a bug related to setting the config to a specific BleDevice instead to all of them somehow?

  • That shouldn't matter (where you set the config). However, if you want it to apply to all devices, I would just set the options in the BleManagerConfig when instantiating the BleManager instance. (BleManagerConfig extends BleDeviceConfig mainly for this purpose). Try doing this, and see if you get any different results.