diff options
author | Alex Blasche <alexander.blasche@theqtcompany.com> | 2015-01-19 11:04:06 +0100 |
---|---|---|
committer | Alex Blasche <alexander.blasche@theqtcompany.com> | 2015-02-02 08:02:42 +0000 |
commit | df1320d940d56a2a8d2b98bde1bce1c4124e9950 (patch) | |
tree | bcdf0cf18f28601f727a93ba6748553188d8b839 | |
parent | cc5a732f3dda39b378459d38d46565f0ce8ef0c3 (diff) |
Android: Enable pairing for Android v15+
The required API became public in Android v19 which is what was used as
check so far. However the same API was already privately provided
since Android v15. THis patch ensures that older Android versions
can create pairing requests too.
This patch was provided by George Najarian.
Task-number: QTBUG-43757
Change-Id: I0f38e538a972341a6acf719098f1010e52b639b7
Reviewed-by: BogDan Vatra <bogdan@kde.org>
Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
-rw-r--r-- | src/bluetooth/android/localdevicebroadcastreceiver.cpp | 4 | ||||
-rw-r--r-- | src/bluetooth/qbluetoothlocaldevice_android.cpp | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/bluetooth/android/localdevicebroadcastreceiver.cpp b/src/bluetooth/android/localdevicebroadcastreceiver.cpp index c54c5e32..a3b92252 100644 --- a/src/bluetooth/android/localdevicebroadcastreceiver.cpp +++ b/src/bluetooth/android/localdevicebroadcastreceiver.cpp @@ -50,8 +50,8 @@ LocalDeviceBroadcastReceiver::LocalDeviceBroadcastReceiver(QObject *parent) : addAction(valueForStaticField(JavaNames::BluetoothAdapter, JavaNames::ActionScanModeChanged)); addAction(valueForStaticField(JavaNames::BluetoothDevice, JavaNames::ActionAclConnected)); addAction(valueForStaticField(JavaNames::BluetoothDevice, JavaNames::ActionAclDisconnected)); - if (QtAndroidPrivate::androidSdkVersion() >= 19) - addAction(valueForStaticField(JavaNames::BluetoothDevice, JavaNames::ActionPairingRequest)); //API 19 + if (QtAndroidPrivate::androidSdkVersion() >= 15) + addAction(valueForStaticField(JavaNames::BluetoothDevice, JavaNames::ActionPairingRequest)); //API 15 //cache integer values for host & bonding mode //don't use the java fields directly but refer to them by name diff --git a/src/bluetooth/qbluetoothlocaldevice_android.cpp b/src/bluetooth/qbluetoothlocaldevice_android.cpp index 4c1b1d4e..11515743 100644 --- a/src/bluetooth/qbluetoothlocaldevice_android.cpp +++ b/src/bluetooth/qbluetoothlocaldevice_android.cpp @@ -376,9 +376,9 @@ void QBluetoothLocalDevice::requestPairing(const QBluetoothAddress &address, Pai return; } - // BluetoothDevice::createBond() requires Android API 19 - if (QtAndroidPrivate::androidSdkVersion() < 19 || !d_ptr->adapter()) { - qCWarning(QT_BT_ANDROID) << "Unable to pair: requires Android API 19+"; + // BluetoothDevice::createBond() requires Android API 15 + if (QtAndroidPrivate::androidSdkVersion() < 15 || !d_ptr->adapter()) { + qCWarning(QT_BT_ANDROID) << "Unable to pair: requires Android API 15+"; QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection, Q_ARG(QBluetoothLocalDevice::Error, QBluetoothLocalDevice::PairingError)); |