Geolocation manager

Geolocation manager — WebKitGeolocationManager

Functions

Properties

Signals

Types and Values

Object Hierarchy

    GBoxed
    ╰── WebKitGeolocationPosition
    GObject
    ╰── WebKitGeolocationManager

Description

WebKitGeolocationManager provides API to get the geographical position of the user. Once a WebKitGeolocationPermissionRequest is allowed, when WebKit needs to know the user location “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 webkit_geolocation_manager_update_position(). The signal “stop” will be emitted when location updates are no longer needed.

Functions

webkit_geolocation_manager_update_position ()

void
webkit_geolocation_manager_update_position
                               (WebKitGeolocationManager *manager,
                                WebKitGeolocationPosition *position);

Notify manager that position has been updated to position .

Parameters

Since: 2.26


webkit_geolocation_manager_failed ()

void
webkit_geolocation_manager_failed (WebKitGeolocationManager *manager,
                                   const char *error_message);

Notify manager that determining the position failed.

Parameters

manager

a WebKitGeolocationManager

 

error_message

the error message

 

Since: 2.26


webkit_geolocation_manager_get_enable_high_accuracy ()

gboolean
webkit_geolocation_manager_get_enable_high_accuracy
                               (WebKitGeolocationManager *manager);

Get whether high accuracy is enabled.

Parameters

Since: 2.26


webkit_geolocation_position_new ()

WebKitGeolocationPosition *
webkit_geolocation_position_new (double latitude,
                                 double longitude,
                                 double accuracy);

Create a new WebKitGeolocationPosition

Parameters

latitude

a valid latitude in degrees

 

longitude

a valid longitude in degrees

 

accuracy

accuracy of location in meters

 

Returns

a newly created WebKitGeolocationPosition.

[transfer full]

Since: 2.26


webkit_geolocation_position_copy ()

WebKitGeolocationPosition *
webkit_geolocation_position_copy (WebKitGeolocationPosition *position);

Make a copy of the WebKitGeolocationPosition

Parameters

Returns

a copy of position .

[transfer full]

Since: 2.26


webkit_geolocation_position_free ()

void
webkit_geolocation_position_free (WebKitGeolocationPosition *position);

Free the WebKitGeolocationPosition

Parameters

Since: 2.26


webkit_geolocation_position_set_timestamp ()

void
webkit_geolocation_position_set_timestamp
                               (WebKitGeolocationPosition *position,
                                guint64 timestamp);

Set the position timestamp. By default it's the time when the position was created.

Parameters

position

a WebKitGeolocationPosition

 

timestamp

timestamp in seconds since the epoch, or 0 to use current time

 

Since: 2.26


webkit_geolocation_position_set_altitude ()

void
webkit_geolocation_position_set_altitude
                               (WebKitGeolocationPosition *position,
                                double altitude);

Set the position altitude

Parameters

position

a WebKitGeolocationPosition

 

altitude

altitude in meters

 

Since: 2.26


webkit_geolocation_position_set_altitude_accuracy ()

void
webkit_geolocation_position_set_altitude_accuracy
                               (WebKitGeolocationPosition *position,
                                double altitude_accuracy);

Set the accuracy of position altitude

Parameters

position

a WebKitGeolocationPosition

 

altitude_accuracy

accuracy of position altitude in meters

 

Since: 2.26


webkit_geolocation_position_set_heading ()

void
webkit_geolocation_position_set_heading
                               (WebKitGeolocationPosition *position,
                                double heading);

Set the position heading, as a positive angle between the direction of movement and the North direction, in clockwise direction.

Parameters

position

a WebKitGeolocationPosition

 

heading

heading in degrees

 

Since: 2.26


webkit_geolocation_position_set_speed ()

void
webkit_geolocation_position_set_speed (WebKitGeolocationPosition *position,
                                       double speed);

Set the position speed

Parameters

position

a WebKitGeolocationPosition

 

speed

speed in meters per second

 

Since: 2.26

Types and Values

struct WebKitGeolocationManager

struct WebKitGeolocationManager;

WebKitGeolocationPosition

typedef struct _WebKitGeolocationPosition WebKitGeolocationPosition;

WebKitGeolocationPosition is an opaque struct used to provide position updates to a WebKitGeolocationManager using webkit_geolocation_manager_update_position().

Since: 2.26

Property Details

The “enable-high-accuracy” property

  “enable-high-accuracy”     gboolean

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

Owner: WebKitGeolocationManager

Flags: Read

Default value: FALSE

Since: 2.26

Signal Details

The “start” signal

gboolean
user_function (WebKitGeolocationManager *manager,
               gpointer                  user_data)

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 webkit_geolocation_manager_update_position() every time the position changes, or use webkit_geolocation_manager_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.

Parameters

manager

the WebKitGeolocationManager on which the signal is emitted

 

user_data

user data set when the signal handler was connected.

 

Returns

TRUE to stop other handlers from being invoked for the event. FALSE to propagate the event further.

Flags: Run Last

Since: 2.26


The “stop” signal

void
user_function (WebKitGeolocationManager *manager,
               gpointer                  user_data)

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

Parameters

manager

the WebKitGeolocationManager on which the signal is emitted

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last

Since: 2.26

See Also

WebKitGeolocationPermissionRequest, WebKitWebContext