Revision control

Copy as Markdown

// Copyright (C) 2026 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\page position-plugin-corelocation.html
\title Qt Positioning Core Location plugin
\ingroup QtPositioning-plugins
\brief Wraps iOS and \macos positioning subsystems.
\section1 Overview
The Qt Positioning Core Location plugin wraps native Apple Core Location APIs
and provides access to positioning information.
The plugin can be loaded by using the provider name \b corelocation.
\section1 Parameters
The following table lists parameters that \e can be passed to the Core Location
plugin.
\table
\header
\li Parameter
\li Description
\row
\li allowAutoPause
\li Controls whether the plugin allows the system to pause location updates
automatically to save power. The default value is \c true. This
parameter is only relevant on iOS when you enable background location
updates. For more details, see
\l {Automatic pausing of location updates}.
\endtable
\section2 Automatic pausing of location updates
On iOS, the underlying \c CLLocationManager can pause location updates
automatically to save battery power when location data is unlikely to change.
To prevent the operating system from pausing location updates while the
application runs in the background, set the \c allowAutoPause plugin parameter
to \c false. The plugin then sets the \c pausesLocationUpdatesAutomatically
property of the \c CLLocationManager instance to \c NO.
This parameter has an effect only if you enable background location updates. To
enable them, add the \c location value to \c UIBackgroundModes in the
\c Info.plist file. See \l {Qt Positioning on iOS} for details.
\section1 Examples
The following examples show how to create a \b corelocation \l PositionSource
from C++ and QML.
\section2 QML
The following snippet creates a \l PositionSource with no parameters. The plugin
uses the default value for \c {allowAutoPause}, which is \c true.
\qml
PositionSource {
name: "corelocation"
}
\endqml
The next snippet explicitly adds the \c {allowAutoPause} \l PluginParameter
and sets its value to \c false.
\qml
PositionSource {
name: "corelocation"
PluginParameter {
name: "allowAutoPause"
value: false
}
}
\endqml
\section2 C++
The following snippet shows how to use C++ to create a
\l {QGeoPositionInfoSource}{position source} with \c {allowAutoPause} disabled.
\code
QVariantMap params;
params["allowAutoPause"] = false;
QGeoPositionInfoSource *positionSource = QGeoPositionInfoSource::createSource("corelocation", params, this);
\endcode
*/