![]() |
![]() |
Geoclue Reference Manual | ![]() |
---|
Building context-sensitive applications is difficult. Location-sensitivy is no exception, but Geoclue tries to help there. With Geoclue it is possible to build location-aware applications with less work and less knowledge about the actual geoinformation sources.
Main features of Geoclue are:
Geoclue is a collection of D-Bus APIs. Internally it's implemented with GLib and GObject (as is the C wrapper library). Several included providers also use Libxml2, and the master provider uses GConf.
There is a GObject-based C API, but using Geoclue is possible from any programming language with D-Bus support.
D-Bus can automatically start services as they're needed so basic method calls can be made without any preparation. However, geoclue providers may shut down when they're not used. This means that clients using signals and clients that set any options should always use AddReference() and RemoveReference() methods to ensure server persistence. In C the wrapper takes care of this.
Clients should not assume that method calls will return instantly or that the response will contain valid data. Examples of possible problems
Using signals should be the first option whenever the used provider supports them. When signals are not available, asynchronous method calls can be used in applications where UI responsiveness is important.
Master provider was designed to solve the following problems:
Master provider implements the same interfaces as regular providers, but internally it uses whichever regular provider happens to be the best one (with "best" defined as a provider that fulfills the accuracy requirements and does not surpass resource restrictions). The internally used provider may change over time -- this does not interrupt clients use in any way, but the changes can be observed using the MasterClient API.
A typical Master provider use includes:
Master provider is fairly new and may not be as stable as the rest of Geoclue.