Location: libportal Reference Manual

## Location Location — access to location information |

## Functions

void | xdp_portal_location_monitor_start ()
gboolean | xdp_portal_location_monitor_start_finish ()
void | xdp_portal_location_monitor_stop ()

## Types and Values

enum | XdpLocationAccuracy

## Description

Location monitoring makes location information available via the “location-updated” signal.

## Functions

### xdp_portal_location_monitor_start ()

    void
    xdp_portal_location_monitor_start (XdpPortal *portal,
                                       XdpParent *parent,
                                       guint distance_threshold,
                                       guint time_threshold,
                                       XdpLocationAccuracy accuracy,
                                       GCancellable *cancellable,
                                       GAsyncReadyCallback callback,
                                       gpointer data);

Makes XdpPortal start monitoring location changes.

When the location changes, the “location-updated”. signal is emitted.

Use `xdp_portal_location_monitor_stop()` to stop monitoring.

Note that XdpPortal only maintains a single location monitor at a time. If you want to change the `distance_threshold` , `time_threshold` or `accuracy` of the current monitor, you first have to call `xdp_portal_location_monitor_stop()` to stop monitoring.

#### Parameters

portal | a XdpPortal |
parent | a XdpParent, or `NULL`. | [nullable]
distance_threshold | distance threshold, in meters |
time_threshold | time threshold, in seconds |
accuracy | desired accuracy |
cancellable | optional GCancellable. | [nullable]
callback | a callback to call when the request is done. | [scope async]
data | data to pass to `callback` . | [closure]

### xdp_portal_location_monitor_start_finish ()

    gboolean
    xdp_portal_location_monitor_start_finish
                                   (XdpPortal *portal,
                                    GAsyncResult *result,
                                    GError **error);

Finishes a location-monitor request, and returns the result in the form of boolean.

#### Parameters

portal | a XdpPortal |
result | a GAsyncResult |
error | return location for an error |

#### Returns

`TRUE` if the request succeeded

### xdp_portal_location_monitor_stop ()

    void
    xdp_portal_location_monitor_stop (XdpPortal *portal);

Stops location monitoring that was started with `xdp_portal_location_monitor_start()`.

#### Parameters

portal | a XdpPortal |

## Types and Values

### enum XdpLocationAccuracy

The values of this enum indicate the desired level of accuracy for location information.

#### Members

XDP_LOCATION_ACCURACY_NONE | No particular accuracy |
XDP_LOCATION_ACCURACY_COUNTRY | Country-level accuracy |
XDP_LOCATION_ACCURACY_CITY | City-level accuracy |
XDP_LOCATION_ACCURACY_NEIGHBORHOOD | Neighborhood-level accuracy |
XDP_LOCATION_ACCURACY_STREET | Street-level accuracy |
XDP_LOCATION_ACCURACY_EXACT | Maximum accuracy |