nsIGeolocationProvider 编辑
xpcom/system/nsIGeolocationProvider.idl
Scriptable 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论