summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/plugins/position/corelocation/corelocation.pro2
-rw-r--r--src/plugins/position/corelocation/qgeopositioninfosource_cl.mm11
-rw-r--r--src/plugins/position/position.pro2
3 files changed, 13 insertions, 2 deletions
diff --git a/src/plugins/position/corelocation/corelocation.pro b/src/plugins/position/corelocation/corelocation.pro
index 25748008..1415643b 100644
--- a/src/plugins/position/corelocation/corelocation.pro
+++ b/src/plugins/position/corelocation/corelocation.pro
@@ -17,5 +17,5 @@ OTHER_FILES += \
plugin.json
osx: LIBS += -framework Foundation
-else: ios: LIBS += -framework CoreFoundation
+else: ios|tvos: LIBS += -framework CoreFoundation
LIBS += -framework CoreLocation
diff --git a/src/plugins/position/corelocation/qgeopositioninfosource_cl.mm b/src/plugins/position/corelocation/qgeopositioninfosource_cl.mm
index 0e5e261b..231f8726 100644
--- a/src/plugins/position/corelocation/qgeopositioninfosource_cl.mm
+++ b/src/plugins/position/corelocation/qgeopositioninfosource_cl.mm
@@ -33,6 +33,7 @@
#include <QTimerEvent>
#include <QDebug>
+#include <QtCore/qglobal.h>
#include "qgeopositioninfosource_cl_p.h"
@@ -74,10 +75,12 @@
location.setAttribute(QGeoPositionInfo::HorizontalAccuracy, newLocation.horizontalAccuracy);
if (newLocation.verticalAccuracy >= 0)
location.setAttribute(QGeoPositionInfo::VerticalAccuracy, newLocation.verticalAccuracy);
+#ifndef Q_OS_TVOS
if (newLocation.course >= 0)
location.setAttribute(QGeoPositionInfo::Direction, newLocation.course);
if (newLocation.speed >= 0)
location.setAttribute(QGeoPositionInfo::GroundSpeed, newLocation.speed);
+#endif
m_positionInfoSource->locationDataAvailable(location);
}
@@ -157,7 +160,11 @@ void QGeoPositionInfoSourceCL::setTimeoutInterval(int msec)
void QGeoPositionInfoSourceCL::startUpdates()
{
if (enableLocationManager()) {
+#ifdef Q_OS_TVOS
+ [m_locationManager requestLocation]; // service will run long enough for one location update
+#else
[m_locationManager startUpdatingLocation];
+#endif
m_started = true;
setTimeoutInterval(m_updateTimeout);
@@ -183,7 +190,11 @@ void QGeoPositionInfoSourceCL::requestUpdate(int timeout)
else if (enableLocationManager()) {
// This will force LM to generate a new update
[m_locationManager stopUpdatingLocation];
+#ifdef Q_OS_TVOS
+ [m_locationManager requestLocation]; // service will run long enough for one location update
+#else
[m_locationManager startUpdatingLocation];
+#endif
setTimeoutInterval(timeout);
} else setError(QGeoPositionInfoSource::AccessError);
diff --git a/src/plugins/position/position.pro b/src/plugins/position/position.pro
index f9492a79..4569810a 100644
--- a/src/plugins/position/position.pro
+++ b/src/plugins/position/position.pro
@@ -3,7 +3,7 @@ TEMPLATE = subdirs
qtHaveModule(dbus):SUBDIRS += geoclue
config_gypsy:SUBDIRS += gypsy
qtHaveModule(simulator):SUBDIRS += simulator
-osx|ios:SUBDIRS += corelocation
+osx|ios|tvos:SUBDIRS += corelocation
android:!android-no-sdk:SUBDIRS += android
winrt:SUBDIRS += winrt
win32:qtHaveModule(serialport):SUBDIRS += serialnmea