diff options
author | Ivan Solovev <ivan.solovev@qt.io> | 2021-07-01 12:55:53 +0200 |
---|---|---|
committer | Ivan Solovev <ivan.solovev@qt.io> | 2021-07-14 14:58:05 +0200 |
commit | d0351428c74dd9f6d9544ca8bdf442317e1976e8 (patch) | |
tree | 02d78dfe282573a084cd4a2acd19b5907c249a6c /src/plugins/position/android/src/qgeopositioninfosource_android_p.h | |
parent | aa02046dfe9c8c160ab872701aab5c7b768f73c2 (diff) | |
download | qtlocation-d0351428c74dd9f6d9544ca8bdf442317e1976e8.tar.gz |
QtPositioning: emit missing UpdateTimeoutError during regular updates
The documentation tells that UpdateTimeoutError will be raised if the
plugin determines that it fails to provide regular updates.
This was not implemented for Android plugin so far.
This patch adds such feature. However, there is no straightforward way
to find out that the Android OS is not able to provide location updates.
For example, analyzing satellite info is not the correct approach,
because the OS also uses network information to provide the location.
As a result, the only reasonable way is to actually detect that there
were no location updates within a certain period of time.
This is the approach that is implemented in this patch. The period is
calculated based on the selected updateInterval() plus some constant.
The constant is large enough for the Android OS to start providing
updates under normal conditions.
Apart from that, the error is raised immediately when the required
location providers are disabled.
Fixes: QTBUG-36854
Pick-to: 6.2
Change-Id: I14e8e95e721efd7fbb09d8d9a6e984f80f7249cc
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src/plugins/position/android/src/qgeopositioninfosource_android_p.h')
-rw-r--r-- | src/plugins/position/android/src/qgeopositioninfosource_android_p.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/plugins/position/android/src/qgeopositioninfosource_android_p.h b/src/plugins/position/android/src/qgeopositioninfosource_android_p.h index 334b42a8..44cb2799 100644 --- a/src/plugins/position/android/src/qgeopositioninfosource_android_p.h +++ b/src/plugins/position/android/src/qgeopositioninfosource_android_p.h @@ -82,17 +82,21 @@ public Q_SLOTS: void locationProvidersChanged(); private Q_SLOTS: void requestTimeout(); + void regularUpdatesTimeout(); private: void reconfigureRunningSystem(); void setError(Error error); - bool updatesRunning; + bool updatesRunning = false; int androidClassKeyForUpdate; int androidClassKeyForSingleRequest; QList<QGeoPositionInfo> queuedSingleUpdates; - Error m_error; + Error m_error = NoError; QTimer m_requestTimer; + QTimer m_regularUpdatesTimer; + qint64 m_lastUpdateTime = 0; + bool m_regularUpdatesErrorRaised = false; }; #endif // QGEOPOSITIONINFOSOURCE_ANDROID_P_H |