Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.3.2, 5.4.1
-
None
Description
Hey,
We were testing our application, and we had connecting issues with Android API <17 devices. So we wrote a second patch for it and it is working now.
The originial ticket is here: https://bugreports.qt.io/browse/QTBUG-40172
Edit:
In the past, there was an issue about Android device connection via bluetooth. We did write a fallback method. All written in here: https://bugreports.qt.io/browse/QTBUG-40172
And then, we encounter another problem but only android 4.1 and below devices was not connecting. So we try another approach for it and tried unsecure connection methods. And then it worked. With this following code, all android devices can connect to our bluetooth broadcaster.
Following code overwrites some part of code of this patch:
https://codereview.qt-project.org/#/c/90473/
in src/bluetooth/qbluetoothsocket_android.cpp:151
QAndroidJniObject method; // android <= 4.1 devices connects only if we are using insecure socket. if (QtAndroid::androidSdkVersion() < 17) { qCWarning(QT_BT_ANDROID) << "Connecting via insecure connection."; method = remoteDeviceClass.callObjectMethod( "getMethod", "(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;", QAndroidJniObject::fromString(QLatin1String("createInsecureRfcommSocket")).object<jstring>(), paramTypes.object<jobjectArray>()); } else { qCWarning(QT_BT_ANDROID) << "Connecting via secure connection."; method = remoteDeviceClass.callObjectMethod( "getMethod", "(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;", QAndroidJniObject::fromString(QLatin1String("createRfcommSocket")).object<jstring>(), paramTypes.object<jobjectArray>()); }
Attachments
Issue Links
- is duplicated by
-
QTBUG-48619 QBluetooth: create insecure Rfcomm connections
- Closed