This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Unable to connect to bonded device on Android

Hi, I have a problem with BLE connection. When I bond to the device and then connect, everything works and connection is stable. When I kill the app and try to connect again to the bonded device, I get disconnected from the Android with status code 22(connection terminated by localhost).

Do you know the difference of these scenarios under the Android hood? I can't figure out why does this keep happening when the phone is obviously able to connect to the device after the bonding procedure.

For connection I use the standard code used in the Android examples, there is no magic going on.

Thanks a lot for your help.

Parents
  • Thanks a lot for your reply. I've been trying it on Pixel with Android 8.0, Moto G4 with Android 7.0, Nexus 5 with Android 8.0 and also Nexus 6P with Android 8.0. The behavior is the same on all of those devices. I found out that if I try to connect to already paired device, the peripheral requests connection update with interval parameter set to 6, which is apparently not supported since Android 6 but I haven't found any documentation that says that if the device doesn't support the requested interval it can disconnect or request disconnection from the peripheral. Do you think that this could be the case?

Reply
  • Thanks a lot for your reply. I've been trying it on Pixel with Android 8.0, Moto G4 with Android 7.0, Nexus 5 with Android 8.0 and also Nexus 6P with Android 8.0. The behavior is the same on all of those devices. I found out that if I try to connect to already paired device, the peripheral requests connection update with interval parameter set to 6, which is apparently not supported since Android 6 but I haven't found any documentation that says that if the device doesn't support the requested interval it can disconnect or request disconnection from the peripheral. Do you think that this could be the case?

Children
No Data
Related