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 .
The following table lists parameters that can be passed to the corelocation plugin.
参数 | 描述 |
---|---|
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:
By default, only the
When In Use
permission is requested. The
RequestAlwaysPermission
parameter is used to explicitly reqeust for
Always
permission.
The following examples show how to create a corelocation PositionSource using different permission levels.
// 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 } }
// 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);