How to use location-observe interface?

Hi, One of my application uses geoclue 2.0 Library to get location data of user. I thought location-observe would be the interface i should use to allow geoclue get the location related data from system, but this seems to fail. When I tried to connect location-observe to core it refused to connect with the following error:

$ snap connect whatsie:location-observe
error: snap "core" has no "location-observe" interface slots

My questions:

  • If core has no location-observe interface, how and where this interface is used ?
  • What interface allows developers packaging their applications that uses geoclue library at runtime ?
    The apparmor denials can help, below is the denial error i got in terminal while initializing the library.

qt.positioning.geoclue2: Unable to obtain the client patch: "org.freedesktop.DBus.Error.AccessDeniedAn AppArmor policy prevents this sender from sending this message to this recipient; type=\"method_call\", sender=\":1.991\" (uid=1000 pid=21846 comm=\"whatsie \") interface=\"org.freedesktop.GeoClue2.Manager\" member=\"GetClient\" error name=\"(unset)\" requested_reply=\"0\" destination=\"org.freedesktop.GeoClue2\" (uid=127 pid=22162 comm=\"/usr/lib/geoclue-2.0/geoclue -t 5 \")" serialnmea: No serial ports found

This might be a bug. The current definition is that only an app snap may provide the location-observe slot, which means that as it stands the core/snapd snaps are not allowed to supply the functionality. It might be a simple oversight, and the definition in snapd should be changed to:

const locationObserveBaseDeclarationSlots = `
  location-observe:
    allow-installation:
      slot-snap-type:
        - app
        - core
    deny-connection: true
    deny-auto-connection: true
`

(This will require that snapd is rebuilt, so is not something you can fix yourself)

1 Like

The interface definition is correct, nothing in core can provide locations currently, you will need a snap providing a location through i.e. gpsd … there used to be a “locationd” snap (a leftover from the ubuntu phone) that has been put to rest though …

1 Like