Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Bluetooth application works fine on Android 5 api22 but not on Android 6 api 23

Bluetooth application works fine on Android 5 api22 but not on Android 6 api 23

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 760 Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Ajay Krishna
    wrote on last edited by
    #1

    Hi All,
    I have developed a Bluetooth application on Qt5.5.10 , in Android 5 api 22 and everything worked fine.
    Now I'm trying to test it on Android 6 api 23,i am able to discover nearby devices but I'm not able to connect to external Bluetooth device.
    This is what I made:

    In project build settings, Android build APK set to Android-23
    In AndroidManifest.xml, Minimum required SDK API 21
    In AndroidManifest.xml, Target SDK API 23
    In AndroidManifest.xml, android.permission.ACCESS_COARSE_LOCATION
    In AndroidManifest.xml, android.permission.ACCESS_FINE_LOCATION
    In AndroidManifest.xml, android.permission.BLUETOOTH
    In AndroidManifest.xml, android.permission.BLUETOOTH_ADMIN

    bluetoothSocket = new QBluetoothSocket(QBluetoothServiceInfo::RfcommProtocol);
    
    bluetoothSocket->connectToService(QBluetoothAddress(string),QBluetoothUuid(QBluetoothUuid::SerialPort),QIODevice::ReadWrite);
    

    I am getting following result :

    D libBlueTooth.so: (null):0 ((null)): qt.bluetooth.android: Connnecting via secure rfcomm
    D libBlueTooth.so: (null):0 ((null)): QBluetoothLocalDevice::Pairing(Paired)
    D libBlueTooth.so: (null):0 ((null)): void MyBlueTooth::devicePairing() Local device Paring
    10-29 11:39:00.925 3026 3082 D libBlueTooth.so:
    D libBlueTooth.so: (null):0 ((null)): qt.bluetooth.android: Connecting socket
    W BluetoothAdapter: getBluetoothService() called with no BluetoothManagerCallback
    D libBlueTooth.so: (null):0 ((null)): qt.bluetooth.android: "LocalDeviceBroadcastReceiver::onReceive() - event: android.bluetooth.device.action.ACL_CONNECTED"
    W System.err: java.io.IOException: read failed, socket might closed or timeout, read ret: -1
    W System.err: at android.bluetooth.BluetoothSocket.readAll(BluetoothSocket.java:745)
    W System.err: at android.bluetooth.BluetoothSocket.readInt(BluetoothSocket.java:757)
    W System.err: at android.bluetooth.BluetoothSocket.connect(BluetoothSocket.java:379)
    W libBlueTooth.so: (null):0 ((null)): qt.bluetooth.android: Falling back to reverse uuid workaround.
    D libBlueTooth.so: (null):0 ((null)): void MyBlueTooth::function3(QBluetoothSocket::SocketError) QBluetoothSocket::ServiceNotFoundError
    10-29 11:39:02.452 3026 3082 D libBlueTooth.so:
    W libBlueTooth.so: (null):0 ((null)): qt.bluetooth.android: Workaround failed
    D libBlueTooth.so: (null):0 ((null)): qt.bluetooth.android: "LocalDeviceBroadcastReceiver::onReceive() - event: android.bluetooth.device.action.ACL_DISCONNECTED"

    Can someone say me where i go wrong ?
    Thanks in advance.

    K 1 Reply Last reply
    1
    • A Ajay Krishna

      Hi All,
      I have developed a Bluetooth application on Qt5.5.10 , in Android 5 api 22 and everything worked fine.
      Now I'm trying to test it on Android 6 api 23,i am able to discover nearby devices but I'm not able to connect to external Bluetooth device.
      This is what I made:

      In project build settings, Android build APK set to Android-23
      In AndroidManifest.xml, Minimum required SDK API 21
      In AndroidManifest.xml, Target SDK API 23
      In AndroidManifest.xml, android.permission.ACCESS_COARSE_LOCATION
      In AndroidManifest.xml, android.permission.ACCESS_FINE_LOCATION
      In AndroidManifest.xml, android.permission.BLUETOOTH
      In AndroidManifest.xml, android.permission.BLUETOOTH_ADMIN

      bluetoothSocket = new QBluetoothSocket(QBluetoothServiceInfo::RfcommProtocol);
      
      bluetoothSocket->connectToService(QBluetoothAddress(string),QBluetoothUuid(QBluetoothUuid::SerialPort),QIODevice::ReadWrite);
      

      I am getting following result :

      D libBlueTooth.so: (null):0 ((null)): qt.bluetooth.android: Connnecting via secure rfcomm
      D libBlueTooth.so: (null):0 ((null)): QBluetoothLocalDevice::Pairing(Paired)
      D libBlueTooth.so: (null):0 ((null)): void MyBlueTooth::devicePairing() Local device Paring
      10-29 11:39:00.925 3026 3082 D libBlueTooth.so:
      D libBlueTooth.so: (null):0 ((null)): qt.bluetooth.android: Connecting socket
      W BluetoothAdapter: getBluetoothService() called with no BluetoothManagerCallback
      D libBlueTooth.so: (null):0 ((null)): qt.bluetooth.android: "LocalDeviceBroadcastReceiver::onReceive() - event: android.bluetooth.device.action.ACL_CONNECTED"
      W System.err: java.io.IOException: read failed, socket might closed or timeout, read ret: -1
      W System.err: at android.bluetooth.BluetoothSocket.readAll(BluetoothSocket.java:745)
      W System.err: at android.bluetooth.BluetoothSocket.readInt(BluetoothSocket.java:757)
      W System.err: at android.bluetooth.BluetoothSocket.connect(BluetoothSocket.java:379)
      W libBlueTooth.so: (null):0 ((null)): qt.bluetooth.android: Falling back to reverse uuid workaround.
      D libBlueTooth.so: (null):0 ((null)): void MyBlueTooth::function3(QBluetoothSocket::SocketError) QBluetoothSocket::ServiceNotFoundError
      10-29 11:39:02.452 3026 3082 D libBlueTooth.so:
      W libBlueTooth.so: (null):0 ((null)): qt.bluetooth.android: Workaround failed
      D libBlueTooth.so: (null):0 ((null)): qt.bluetooth.android: "LocalDeviceBroadcastReceiver::onReceive() - event: android.bluetooth.device.action.ACL_DISCONNECTED"

      Can someone say me where i go wrong ?
      Thanks in advance.

      K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      @Ajay-Krishna

      Hi and welcome to devnet forum

      More out of gut feeling than knowledge I am assuming that something might have changed on the Android side.

      Possibly it is better to check also in Android groups e.g. android-qt or others for an answer on this. However, android-qt has slowed down significantly over time.

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved