Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

nsIGeolocationProvider

Notify the geolocation service that a new geolocation has been discovered.
1.0
28
Introduced
Gecko 1.9.1
Inherits from: nsISupports Last changed in Gecko 1.9.2 (Firefox 3.6 / Thunderbird 3.1 / Fennec 1.0)

This must be called on the main thread Interface provides location information to the nsGeolocator via the nsIDOMGeolocationCallback interface. After startup() is called, any geo location change should call callback.update().

The nsIGeolocationProvider interface provides information about the current users location to interested parties via nsIGeolocationUpdate. After the provider has been initialized, any changes to location should call callback.onRequest().

You may find the WiFi access point monitoring service useful if you wish to implement support for WiFi-based location services. See dom/src/geolocation/NetworkGeolocationProvider.js for an example of how to write a geolocation provider.

Method overview

boolean isReady(); Obsolete since Gecko 1.9.2
void shutdown();
void startup();
void watch(in nsIGeolocationUpdate callback);

Methods

Obsolete since Gecko 1.9.2 (Firefox 3.6 / Thunderbird 3.1 / Fennec 1.0)

isReady()

Reports whether or not the device is ready and has a position.

boolean isReady();
Parameters

None.

Return value

true if the device is ready and has a position available to return; otherwise false.

shutdown()

Shuts down the location device.

void shutdown();
Parameters

None.

startup()

Start up the provider. This is called before any other method and may be called multiple times.

void startup();
Parameters

None.

watch()

Attaches a callback listener to be notified when a location change is observed.

void watch(
  in nsIGeolocationUpdate callback
);
Parameters
callback
An nsIGeolocationUpdate to be notified when position changes. Your location provider should call this routine whenever new position data is available.

See also

Document Tags and Contributors

 Contributors to this page: Sheppy, trevorh, Wjjohnst
 Last updated by: Sheppy,