nsIGeolocationProvider 编辑

xpcom/system/nsIGeolocationProvider.idlScriptable Notify the geolocation service that a new geolocation has been discovered. 1.0 66 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

isReady()

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

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:35 次

字数:4536

最后编辑:7年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文