summaryrefslogtreecommitdiffstats
path: root/examples/bluetooth
diff options
context:
space:
mode:
authorOliver Wolff <oliver.wolff@qt.io>2020-02-11 12:48:38 +0100
committerOliver Wolff <oliver.wolff@qt.io>2020-02-11 14:29:42 +0100
commitb9502e498c1033b8334afca7808807d3b6f00926 (patch)
tree5b9fde2710becafa1993c30c89a02d1d9925ad1a /examples/bluetooth
parent0bb394194aad69574b98de5b43da82b0f0a4a454 (diff)
"Fix" heartrate-server on Android
This is a workaround for QTBUG-80533. Command line applications are no longer supported on Android. As we use the heartrate examples as test cases for bluetooth, we work around this problem by instanciating a gui application which fixes the compile error on Android. Change-Id: If06767eb6ff534077f193163991d9d506c17e50e Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'examples/bluetooth')
-rw-r--r--examples/bluetooth/heartrate-server/heartrate-server.pro1
-rw-r--r--examples/bluetooth/heartrate-server/main.cpp8
2 files changed, 9 insertions, 0 deletions
diff --git a/examples/bluetooth/heartrate-server/heartrate-server.pro b/examples/bluetooth/heartrate-server/heartrate-server.pro
index edd011b9..0333ffc9 100644
--- a/examples/bluetooth/heartrate-server/heartrate-server.pro
+++ b/examples/bluetooth/heartrate-server/heartrate-server.pro
@@ -2,6 +2,7 @@ TEMPLATE = app
TARGET = heartrate-server
QT = core bluetooth
+android: QT += gui
CONFIG += c++11
SOURCES += main.cpp
diff --git a/examples/bluetooth/heartrate-server/main.cpp b/examples/bluetooth/heartrate-server/main.cpp
index ea01d07d..7986edd6 100644
--- a/examples/bluetooth/heartrate-server/main.cpp
+++ b/examples/bluetooth/heartrate-server/main.cpp
@@ -57,7 +57,11 @@
#include <QtBluetooth/qlowenergyservice.h>
#include <QtBluetooth/qlowenergyservicedata.h>
#include <QtCore/qbytearray.h>
+#ifndef Q_OS_ANDROID
#include <QtCore/qcoreapplication.h>
+#else
+#include <QtGui/qguiapplication.h>
+#endif
#include <QtCore/qlist.h>
#include <QtCore/qloggingcategory.h>
#include <QtCore/qscopedpointer.h>
@@ -66,7 +70,11 @@
int main(int argc, char *argv[])
{
//QLoggingCategory::setFilterRules(QStringLiteral("qt.bluetooth* = true"));
+#ifndef Q_OS_ANDROID
QCoreApplication app(argc, argv);
+#else
+ QGuiApplication app(argc, argv);
+#endif
//! [Advertising Data]
QLowEnergyAdvertisingData advertisingData;