This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to auto reconnect to BLE in android when it is in range and starts advertising?

I am develop in Android BLE , I have no idea about Auto reconnect to BLE device in android when it is in range and starts advertising

I have reference the Android BLE Connect. The second parameter for autoConnect in mBluetoothGatt = device.connectGatt(this, true, mGattCallback); , and set it to true.

After I take away the BLE device's battery and power on again. The BLE device has advertising. But the Android App didn't auto reconnect to the BLE device.

I have to call startLeScan and connectGatt again by myself.

Does there has batter way to auto reconnect to BLE in android when it is in range and starts advertising ?

Parents
  • Hi Wen,

    It should work that way. Have you make sure you didn't do anything else when the device disconnected? I heard that on some Android phone the function didn't work properly. Which phone are you testing ?

    You can actually test this function using the nRF Master Control panel. There is a dropdown menu next to the Connect button where you can select "Connect with autoConnect". In my test here with the galaxy S4, the app automatically connect back when the nRF51 is turned on and advertising again.

  • when Device connect , I execute gatt.close() , gatt.disconnect , gatt = null. Is these code affect to the reconnect ?

Reply Children
No Data
Related