Class wink.api.GeoLocation
Implements a geographical locator. It starts watching for position changes when a listener is adding and stops if there is no more listener. To optimize the data processing, it gets the stringent constraints (depends on listeners properties) which requires it to refresh datas more often and more precisely. Then it notifies listeners when it is deemed necessary (depends on listeners properties : "notification interval", "only If Position Changed").
- Defined in: geolocation.js
| Constructor Attributes | Constructor Name and Description |
|---|---|
| Compatibility list | Supported platforms / browsers |
|---|---|
|
iOS2, iOS3, iOS4, iOS5, iOS6, Android 1.1, Android 1.5, Android 2.1, Android 2.2, Android 2.3, Android 3.0, Android 3.1, Android 4.0, Windows Phone 7.5, Windows Phone 8
|
Method Summary
Class Detail
wink.api.GeoLocation()
var geoloc = new wink.api.GeoLocation();
geoloc.addListener({ context: window, method: "accuratePositionChanged" }, 60000, true, true);
geoloc.addListener({ context: window, method: "positionChanged" }, 10000, true, false);
- See:
- Test page
Field Detail
{integer}
uId
Unique identifier
Method Detail
-
addListener(callback, notificationInterval, onlyIfPositionChanged, highAccuracy)Adds a Geo Location listener.
- Parameters:
- {object|function} callback
- The callback to invoke
- {integer} notificationInterval
- The interval between callback calls
- {boolean} onlyIfPositionChanged
- Indicates whether the callback must be invoked only if location changed
- {boolean} highAccuracy
- Indicates whether the high result accuracy is enabled
-
{object} getPosition()Returns the current geolocation informations or null if GeoLocation is not initialized. At least one listener must be added to initialize the GeoLocation.
- Returns:
- {object} The geolocation information
-
removeListener(callback)Removes the given Geo Location listener.
- Parameters:
- {object|function} callback
- The callback that identifies the listener