Solved Qt Bluetooth on iOS and Android
-
I'm developing a cross-platform app which requires Bluetooth connection (sending and receiving data) on both Android and iOS. I'm using Classic Bluetooth API and my app perfectly works on Android while on iOS I'm not able to establish the Bluetooth connection. My Bluetooth module is HC-06 and Im using this API. Does Qt support Bluetooth on iOS or there's something that I'm doing wrong?
-
@Raad oh, I actually didn't see/know that
That's a major flaw in the API 🤦♂️
Well classical Bt is available on iOS. So you could potentially write something in objective-c and include that in your project.
That or indeed, if you can, change to BTLE
-
@Raad There's a ton of reasons why this could be the case
I'm using BTLE on iOS and that works fine. I know its not quite the same.
what about this examples:
https://doc.qt.io/qt-5/bluetooth-examples.html
Those that I tested work on iOS fine.
maybe you need to adjust the info.plist file, since Apple added a new key requirement
<key>NSBluetoothAlwaysUsageDescription</key>
since I last tested one of those. -
@J-Hilk Thank you for helping me as always!
I have partially implemented my code on iOS just to make sure if the problem is with the Bluetooth API or something else and seems like it's directly related to the API. I saw here that Classic Bluetooth is not compatible on iOS. does it mean that I essentially need to change my module and API and use BLE or there is a way to go around that? -
@Raad oh, I actually didn't see/know that
That's a major flaw in the API 🤦♂️
Well classical Bt is available on iOS. So you could potentially write something in objective-c and include that in your project.
That or indeed, if you can, change to BTLE
-
@J-Hilk Alright in that case I think it's easier for me to change the module and use BLE API rather than using objective-c. Thank you so much for clearing that out for me!