GeolocationManager#

Added in version 2.26.

class GeolocationManager(**properties: Any)#

Superclasses: Object

Geolocation manager.

WebKitGeolocationManager provides API to get the geographical position of the user. Once a WebKitGeolocationPermissionRequest is allowed, when WebKit needs to know the user location GeolocationManager::start signal is emitted. If the signal is handled and returns True, the application is responsible for providing the position every time it’s updated by calling update_position(). The signal GeolocationManager::stop will be emitted when location updates are no longer needed.

Methods#

class GeolocationManager
failed(error_message: str) None#

Notify manager that determining the position failed.

Added in version 2.26.

Parameters:

error_message – the error message

get_enable_high_accuracy() bool#

Get whether high accuracy is enabled.

Added in version 2.26.

update_position(position: GeolocationPosition) None#

Notify manager that position has been updated to position.

Added in version 2.26.

Parameters:

position – a GeolocationPosition

Properties#

class GeolocationManager
props.enable_high_accuracy: bool#

Whether high accuracy is enabled. This is a read-only property that will be set to True when a GeolocationManager needs to get accurate position updates. You can connect to notify::enable-high-accuracy signal to monitor it.

Added in version 2.26.

Signals#

class GeolocationManager.signals
start() bool#

The signal is emitted to notify that manager needs to start receiving position updates. After this signal is emitted the user should provide the updates using update_position() every time the position changes, or use failed() in case it isn’t possible to determine the current position.

If the signal is not handled, WebKit will try to determine the position using GeoClue if available.

Added in version 2.26.

stop() None#

The signal is emitted to notify that manager doesn’t need to receive position updates anymore.

Added in version 2.26.