The Qt Positioning Android plugin wraps native Android APIs and provides access to positioning and satellite information.
The plugin can be loaded by using the provider name android.
The following table lists parameters that can be passed to the Android plugin.
| Parameter | Description |
|---|---|
| useMslAltitude |
The parameter is introduced in Qt 6.8. It determines if the plugin will try to provide an altitude above Mean Sea Level (MSL). The default value is false, which means that it provides the
altitude in WGS84 format. This parameter is only relevant for Android 14 and later. See Altitude Conversion section for more details.
|
Android traditionally provides altitude above the World Geodetic System 1984 (WGS84) reference ellipsoid. However, starting from Android 14, a new AltitudeConverter class was introduced. This class allows to convert the WGS84 altitude into altitude above Mean Sea Level (MSL) format.
If the useMslAltitude plugin parameter is set to true, and the application is running on Android 14 or later, the QGeoCoordinate::altitude component of QGeoPositionInfo objects retrieved during position updates will contain the MSL altitude.
Note: According to the Android documentation, the conversion to the MSL altitude may take several seconds. It means that lastKnownPosition() requests may execute longer when this feature is enabled, because the method is synchronous. Other position update requests are not affected.
The following examples show how to create an android PositionSource from C++ and QML.
The following snippet creates a PositionSource with no parameters. The altitude will be reported in WGS84 format.
PositionSource { name: "android" }
The next snippet explicitly adds the useMslAltitude PluginParameter and sets its value to true. This PositionSource will report the altitude in MSL format.
PositionSource { name: "android" PluginParameter { name: "useMslAltitude" value: true } }
The following snippet shows how to use C++ to create a position source which reports the altitude in MSL format.
QVariantMap params; params["useMslAltitude"] = true; QGeoPositionInfoSource *positionSource = QGeoPositionInfoSource::createSource("android", params, this);
As part of the free Business evaluation, we offer a free welcome call for companies, to talk about your requirements, and how the Felgo SDK & Services can help you. Just sign up and schedule your call.
Sign up now to start your free Business evaluation: