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

Reconnect device with existing bond with android

I am trying to re-connect my android phone to nrf51822 using already existing bond, I am able to reconnect to the card, but the issue is I still need to perform gatt.discoverServices, and then setCharacteristicNotification, then writeDescriptor to receive the callback of the bluetooth device.

There is no problem for me to connect and bond to the target device with my android phone, the issue is that once I restart the bluetooth on the phone, and try to reconnect to the bluetooth device, I still need to recreate a new bond in order to communicate with my target device successfully. Is there anyway to use existing bond instead creating a new one? (By recreating a bond I mean enable notification and write descriptor to create bond)

I am expecting that only the first time when I connect and bond the target bluetooth device, i need to enable notification and write descriptor, and then if android's bluetooth got turned off and back on, I should be able to use the existing bond(which I can see from my bluetooth setting, my device name is still there) so I do not need to redo the same service discovery, setCharacteristicNotification, then writeDescriptor again. Is this possible?

Parents
  • Hi Hung,

    Yes, I mentioned in my post(last paragraph) that I can see the device in my bonded list.

    Yes, it worked normally if I just the connect is lost by long range, and it reconnects just fine when it is in range. I would use existing bond info.

    I am using nexus 5, nexus 6, nexus 7. They are all either latest android api 23 or 24.

    I will look into the sniffer trace. Thanks.

Reply
  • Hi Hung,

    Yes, I mentioned in my post(last paragraph) that I can see the device in my bonded list.

    Yes, it worked normally if I just the connect is lost by long range, and it reconnects just fine when it is in range. I would use existing bond info.

    I am using nexus 5, nexus 6, nexus 7. They are all either latest android api 23 or 24.

    I will look into the sniffer trace. Thanks.

Children
No Data
Related