Android 6.0 Marshmallow - unable to connect to a Bluetooth peripheral when scanning another application

I have an application that runs a continuous Bluetooth scan in the background with SCAN_MODE_LOW_POWER (similar to AltBeacon).

While the service is running, I cannot connect to bluetooth peripherals with various applications, such as the nRF main controller and BLE Scanner (very popular). When I close the service and then stop and start Bluetooth on the smartphone, the connection is successful.

I do not know if these applications use the new Api (BluetoothLeScanner from level 21) or the old one. In any case, it does not make sense that one application can prevent other applications from connecting to peripheral devices (unless, of course, the application does not connect in parallel to the maximum number of peripheral devices that the device can support), but this is not so).

Can anyone explain this? Has this happened to you before? Is this a known bug? Could there be a collision between applications that use the new Api and applications that still use the old Api?

I tested this on both the Nexus 5 and the Samsung Galaxy S5 - both on Android 6.0.

--- Edit ---

I developed a simple “connect application” with the latest SDK, including:

compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:support-v13:23.1.1'

(in build.gradle)

 <uses-sdk
    android:minSdkVersion="21"
    android:targetSdkVersion="23" />
 ...
 <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

(in manifest)

, Android 6.0. - ( !), " " - BluetoothGattCallback. onConnectionStateChange 133 STATE_DISCONNECTED.

, -, , (, SDK ). , " " - ? AltBeacon?

--- ---

SDK 23.1.1. "" . " "? , , ? ...

+4

Source: https://habr.com/ru/post/1619420/


All Articles