Konubinix' opinionated web of thoughts

Bluetooth in Android

Fleeting

bluetooth in Android

UPDATE 10/2019

Support is there! Enjoy the new API:

BluetoothDevice.createL2capChannel(int) BluetoothDevice.createInsecureL2capChannel(int) BluetoothAdapter.listenUsingL2capChannel() BluetoothAdapter.listenUsingInsecureL2capChannel()

UPDATE 03/2019 With the first Android Q beta out there it looks like support is finally coming.

https://developer.android.com/sdk/api_diff/q-beta1/changes.html

https://stackoverflow.com/questions/51614736/how-can-i-instantiate-a-l2cap-socket-in-android

source code for the android version 8+ offers a way to get a l2cap socket that is evolving in time:

A createL2capSocket method in android 8 (source) A createL2capCoCSocket method in android 9 (source) A createL2capChannel in the master branch of the android project (future release I guess?) (source)

https://stackoverflow.com/questions/51614736/how-can-i-instantiate-a-l2cap-socket-in-android

we were able to test on android 8, with awful results.

https://stackoverflow.com/questions/51614736/how-can-i-instantiate-a-l2cap-socket-in-android

Testing on Android 8.1 with reflection led to very unsatisfying results. The claim that “LE Connection-Oriented Channels” are available since Android 8.0 just can’t be confirmed, despite the efforts.

https://stackoverflow.com/questions/51614736/how-can-i-instantiate-a-l2cap-socket-in-android

will take years before l2cap channels will be reliable and available to a significant share of the android users.

https://stackoverflow.com/questions/51614736/how-can-i-instantiate-a-l2cap-socket-in-android

Notes linking here