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
14The Qt Positioning Core Location plugin wraps native Apple Core Location APIs
15and provides access to positioning information.
16
17The plugin can be loaded by using the provider name \b corelocation.
18
19\section1 Parameters
20
21The following table lists parameters that \e can be passed to the Core Location
22plugin.
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
39On iOS, the underlying \c CLLocationManager can pause location updates
40automatically to save battery power when location data is unlikely to change.
41
42To prevent the operating system from pausing location updates while the
43application runs in the background, set the \c allowAutoPause plugin parameter
44to \c false. The plugin then sets the \c pausesLocationUpdatesAutomatically
45property of the \c CLLocationManager instance to \c NO.
46
47This parameter has an effect only if you enable background location updates. To
48enable 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
53The following examples show how to create a \b corelocation \l PositionSource
54from C++ and QML.
55
56\section2 QML
57
58The following snippet creates a \l PositionSource with no parameters. The plugin
59uses the default value for \c {allowAutoPause}, which is \c true.
60
61\qml
62PositionSource {
63 name: "corelocation"
64}
65\endqml
66
67The next snippet explicitly adds the \c {allowAutoPause} \l PluginParameter
68and sets its value to \c false.
69
70\qml
71PositionSource {
72 name: "corelocation"
73 PluginParameter {
74 name: "allowAutoPause"
75 value: false
76 }
77}
78\endqml
79
80\section2 C++
81
82The following snippet shows how to use C++ to create a
83\l {QGeoPositionInfoSource}{position source} with \c {allowAutoPause} disabled.
84
85\code
86QVariantMap params;
87params["allowAutoPause"] = false;
88QGeoPositionInfoSource *positionSource = QGeoPositionInfoSource::createSource("corelocation", params, this);
89\endcode
90
91*/