Android 6.0 won't connect to BLE device anymore after turning bluetooth off and back on again

JPS

I've written an app that scans for bluetooth smart devices, you can pick one from a list, connect to it and exchange some data. All went fine until Android 6.0.

First, i fixed the new permission system so the app requests the location permission at runtime to be able to scan for devices. With that the app worked like it used to, but after turning bluetooth off and back on again the app won't connect anymore but always returns disconnected state with status code 133 in the gatt callback.

I then tried several things:

  • rebooted the device
  • re-installed the app
  • turn off wifi, enable / disable flight mode
  • checked with NRF master control panel, same issue with same statuscode

This all didn't solve the problem. The only way i was able to get it working again was the option "Network Settings Reset" from the menu "Backup & reset". Both development phones available here (Moto G3 and Samsung S6) feature this option, haven't seen it before Android 6.0.

My question is: are there others experiencing this problem and is there a fix or workaround for this? This could cause a lot of troubles, it so common to turn off /on bluetooth and the problem also appears after been in flight-mode.

JPS

Ok, so after a while i tackled this. I was working with NRF ble devices and could not connect but i was still able to connect to TI sensorTag devices.

There were some differences between the advertisements of the devices, some flags were not enabled for the NRF device and also the NRF device had no device name set. After changing this, i was able to connect again. Turned out that devicename must be enabled but can be left empty.

It seems in the Android 6.0 ble stack there is a change in how the connection to a device is made, the device is not connectable anymore if not the right advertisement settings are used after bluetooth is turned off and on again.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Android Device won't connect to ADB

From Dev

Wifi won't turn back on after I accidentally turned it off

From Dev

Android BLE connect to device by Name

From Dev

Android BLE connect to device by Name

From Dev

Catching DeadObjectException raised while calling BluetoothGatt.connect() after reseting Bluetooth chip on Android 4.3 Bluetooth BLE

From Dev

Android Connect Bluetooth device automatically after pairing programmatically

From Dev

How to connect the Bluetooth device in Android

From Dev

Android bluetooth connect to paired device

From Dev

How to connect the Bluetooth device in Android

From Dev

Android bluetooth connect to paired device

From Dev

USB Audio card fails to initialize after turning it off and on again

From Dev

USB Audio card fails to initialize after turning it off and on again

From Dev

Android Wear can't connect my device via bluetooth

From Dev

Why can't I view and connect to a Bluetooth LE device? (Android)

From Dev

Windows UWP connect to BLE device after discovery

From Dev

X: alt/ctrl/f1 doesn't work any more after turning the display off and on again with xrandr

From Dev

Alsamixer won't work with bluetooth device

From Dev

Android Studio won't mark problems anymore

From Dev

Connect BLE device to Android an Send Data (nUART)

From Dev

Android ble app crash if bluetooth is turned off in android lollipop

From Dev

Android ble app crash if bluetooth is turned off in android lollipop

From Dev

Android BLE: How to check if bonded BLE Device is available to connect

From Dev

Why won't Sony Bluetooth Headphones Connect?

From Dev

16.04 LTS: bluetooth still running after turning it OFF, impossible to really stop bluetooth

From Dev

Display turns off after two minute of inactivity and won't come back on until I restart

From Dev

Bluetooth Logitech Ultrathin Touch Mouse won't connect (or disconnects after some time)

From Dev

Android - Could not connect to bluetooth device on Lollipop

From Dev

Android AlertDialog won't show until after bluetoothsocket.connect()

From Dev

Android listing BLE devices after device scan

Related Related

  1. 1

    Android Device won't connect to ADB

  2. 2

    Wifi won't turn back on after I accidentally turned it off

  3. 3

    Android BLE connect to device by Name

  4. 4

    Android BLE connect to device by Name

  5. 5

    Catching DeadObjectException raised while calling BluetoothGatt.connect() after reseting Bluetooth chip on Android 4.3 Bluetooth BLE

  6. 6

    Android Connect Bluetooth device automatically after pairing programmatically

  7. 7

    How to connect the Bluetooth device in Android

  8. 8

    Android bluetooth connect to paired device

  9. 9

    How to connect the Bluetooth device in Android

  10. 10

    Android bluetooth connect to paired device

  11. 11

    USB Audio card fails to initialize after turning it off and on again

  12. 12

    USB Audio card fails to initialize after turning it off and on again

  13. 13

    Android Wear can't connect my device via bluetooth

  14. 14

    Why can't I view and connect to a Bluetooth LE device? (Android)

  15. 15

    Windows UWP connect to BLE device after discovery

  16. 16

    X: alt/ctrl/f1 doesn't work any more after turning the display off and on again with xrandr

  17. 17

    Alsamixer won't work with bluetooth device

  18. 18

    Android Studio won't mark problems anymore

  19. 19

    Connect BLE device to Android an Send Data (nUART)

  20. 20

    Android ble app crash if bluetooth is turned off in android lollipop

  21. 21

    Android ble app crash if bluetooth is turned off in android lollipop

  22. 22

    Android BLE: How to check if bonded BLE Device is available to connect

  23. 23

    Why won't Sony Bluetooth Headphones Connect?

  24. 24

    16.04 LTS: bluetooth still running after turning it OFF, impossible to really stop bluetooth

  25. 25

    Display turns off after two minute of inactivity and won't come back on until I restart

  26. 26

    Bluetooth Logitech Ultrathin Touch Mouse won't connect (or disconnects after some time)

  27. 27

    Android - Could not connect to bluetooth device on Lollipop

  28. 28

    Android AlertDialog won't show until after bluetoothsocket.connect()

  29. 29

    Android listing BLE devices after device scan

HotTag

Archive