- Qt 5.15
- Qt Positioning
- Qt Positioning Core Location plugin
- Qt 5.15.17 Reference Documentation

# Qt Positioning Core Location plugin

## Overview

The plugin wraps iOS and macOS positioning subsystems. It is only available on Apple platforms that support corelocation. The plugin provides only positioning information.

This plugin can be loaded by using the provider name corelocation.

## Parameters

The following table lists parameters that can be passed to the corelocation plugin.

Parameter | Description
--- | ---
RequestAlwaysPermission | Ask permissions for using location not only while using the application, but also in background. The parameter is a `bool`, so it accepts either `true` or `false`. If the parameter is not specified, it is considered to be `false`.

On iOS, the application can ask for two levels of location permissions:

- When In Use - makes location updates available only when someone uses your app.
- Always - makes location updates available at any time, and lets the system launch your app quietly to handle some updates.

By default, only the When In Use permission is requested. The `RequestAlwaysPermission` parameter is used to explicitly reqeust for Always permission.

## Position source usage example

The following examples show how to create a corelocation PositionSource using different permission levels.

### QML

     // default - When In Use permission.
     PositionSource {
         name: "corelocation"
     }
     // RequestAlwaysPermission = false. Same as default.
     PositionSource {
         name: "corelocation"
         PluginParameter { name: "RequestAlwaysPermission"; value: false }
     }
     // RequestAlwaysPermission = true. Request Always permission.
     PositionSource {
         name: "corelocation"
         PluginParameter { name: "RequestAlwaysPermission"; value: true }
     }

### C++

     // default - When In Use permission.
     QGeoPositionInfoSource *defaultSource
                     = QGeoPositionInfoSource::createSource("corelocation", this);
     // RequestAlwaysPermission = false. Same as default.
     params["RequestAlwaysPermission"] = false;
     QGeoPositionInfoSource *whenInUseSource
                     = QGeoPositionInfoSource::createSource("corelocation", params, this);
     // RequestAlwaysPermission = true. Request Always permission.
     params["RequestAlwaysPermission"] = true;
     QGeoPositionInfoSource *alwaysSource
                     = QGeoPositionInfoSource::createSource("corelocation", params, this);