Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
corelocation.qdoc
Go to the documentation of this file.
1
// Copyright (C) 2026 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3
4
/*!
5
6
\page position-plugin-corelocation.html
7
\title Qt Positioning Core Location plugin
8
\ingroup QtPositioning-plugins
9
10
\brief Wraps iOS and \macos positioning subsystems.
11
12
\section1 Overview
13
14
The Qt Positioning Core Location plugin wraps native Apple Core Location APIs
15
and provides access to positioning information.
16
17
The plugin can be loaded by using the provider name \b corelocation.
18
19
\section1 Parameters
20
21
The following table lists parameters that \e can be passed to the Core Location
22
plugin.
23
24
\table
25
\header
26
\li Parameter
27
\li Description
28
\row
29
\li allowAutoPause
30
\li Controls whether the plugin allows the system to pause location updates
31
automatically to save power. The default value is \c true. This
32
parameter is only relevant on iOS when you enable background location
33
updates. For more details, see
34
\l {Automatic pausing of location updates}.
35
\endtable
36
37
\section2 Automatic pausing of location updates
38
39
On iOS, the underlying \c CLLocationManager can pause location updates
40
automatically to save battery power when location data is unlikely to change.
41
42
To prevent the operating system from pausing location updates while the
43
application runs in the background, set the \c allowAutoPause plugin parameter
44
to \c false. The plugin then sets the \c pausesLocationUpdatesAutomatically
45
property of the \c CLLocationManager instance to \c NO.
46
47
This parameter has an effect only if you enable background location updates. To
48
enable them, add the \c location value to \c UIBackgroundModes in the
49
\c Info.plist file. See \l {Qt Positioning on iOS} for details.
50
51
\section1 Examples
52
53
The following examples show how to create a \b corelocation \l PositionSource
54
from C++ and QML.
55
56
\section2 QML
57
58
The following snippet creates a \l PositionSource with no parameters. The plugin
59
uses the default value for \c {allowAutoPause}, which is \c true.
60
61
\qml
62
PositionSource {
63
name: "corelocation"
64
}
65
\endqml
66
67
The next snippet explicitly adds the \c {allowAutoPause} \l PluginParameter
68
and sets its value to \c false.
69
70
\qml
71
PositionSource {
72
name: "corelocation"
73
PluginParameter {
74
name: "allowAutoPause"
75
value: false
76
}
77
}
78
\endqml
79
80
\section2 C++
81
82
The following snippet shows how to use C++ to create a
83
\l {QGeoPositionInfoSource}{position source} with \c {allowAutoPause} disabled.
84
85
\code
86
QVariantMap params;
87
params["allowAutoPause"] = false;
88
QGeoPositionInfoSource *positionSource = QGeoPositionInfoSource::createSource("corelocation", params, this);
89
\endcode
90
91
*/
qtpositioning
src
positioning
doc
src
plugins
corelocation.qdoc
Generated on
for Qt by
1.16.1