Difference between revisions of "Geolocation"
(template) |
|||
Line 5: | Line 5: | ||
'''<translate>Available since</translate>:''' Gideros 2012.8<br/> | '''<translate>Available since</translate>:''' Gideros 2012.8<br/> | ||
'''<translate>Inherits from</translate>:''' [[Special:MyLanguage/Object|Object]]<br/> | '''<translate>Inherits from</translate>:''' [[Special:MyLanguage/Object|Object]]<br/> | ||
+ | |||
=== <translate>Description</translate> === | === <translate>Description</translate> === | ||
− | + | The [[Special:MyLanguage/Geolocation|Geolocation]] class is used to configure the parameters and dispatching of location and heading related events. | |
− | The [[Special:MyLanguage/Geolocation|Geolocation]] class is used to configure the parameters and dispatching of location and heading related events. | + | |
− | |||
=== <translate>Examples</translate> === | === <translate>Examples</translate> === | ||
− | + | <source lang="lua"> | |
− | <source lang="lua">geolocation = Geolocation.new() | + | geolocation = Geolocation.new() |
local function onLocationUpdate(event) | local function onLocationUpdate(event) | ||
Line 23: | Line 23: | ||
geolocation:addEventListener(Event.LOCATION_UPDATE, onLocationUpdate) | geolocation:addEventListener(Event.LOCATION_UPDATE, onLocationUpdate) | ||
geolocation:addEventListener(Event.HEADING_UPDATE, onHeadingUpdate) | geolocation:addEventListener(Event.HEADING_UPDATE, onHeadingUpdate) | ||
− | geolocation:start()</source> | + | geolocation:start() |
+ | </source> | ||
+ | |||
{|- | {|- | ||
| style="width: 50%; vertical-align:top;"| | | style="width: 50%; vertical-align:top;"| | ||
Line 40: | Line 42: | ||
[[Special:MyLanguage/Geolocation:stopUpdatingHeading|Geolocation:stopUpdatingHeading]] ''<translate>stops the generation of updates that report the heading</translate>''<br/><!-- GIDEROSMTD:Geolocation:stopUpdatingHeading() stops the generation of updates that report the heading --> | [[Special:MyLanguage/Geolocation:stopUpdatingHeading|Geolocation:stopUpdatingHeading]] ''<translate>stops the generation of updates that report the heading</translate>''<br/><!-- GIDEROSMTD:Geolocation:stopUpdatingHeading() stops the generation of updates that report the heading --> | ||
[[Special:MyLanguage/Geolocation:stopUpdatingLocation|Geolocation:stopUpdatingLocation]] ''<translate>stops the generation of updates that report the current location</translate>''<br/><!-- GIDEROSMTD:Geolocation:stopUpdatingLocation() stops the generation of updates that report the current location --> | [[Special:MyLanguage/Geolocation:stopUpdatingLocation|Geolocation:stopUpdatingLocation]] ''<translate>stops the generation of updates that report the current location</translate>''<br/><!-- GIDEROSMTD:Geolocation:stopUpdatingLocation() stops the generation of updates that report the current location --> | ||
+ | |||
| style="width: 50%; vertical-align:top;"| | | style="width: 50%; vertical-align:top;"| | ||
=== <translate>Events</translate> === | === <translate>Events</translate> === | ||
Line 47: | Line 50: | ||
=== <translate>Constants</translate> === | === <translate>Constants</translate> === | ||
|} | |} | ||
− | |||
− |
Revision as of 23:30, 9 December 2019
Supported platforms:
Available since: Gideros 2012.8
Inherits from: Object
Description
The Geolocation class is used to configure the parameters and dispatching of location and heading related events.
Examples
geolocation = Geolocation.new()
local function onLocationUpdate(event)
print("location: ", event.latitude, event.longitude, event.altitude)
end
local function onHeadingUpdate(event)
print("heading: ", event.magneticHeading, event.trueHeading)
end
geolocation:addEventListener(Event.LOCATION_UPDATE, onLocationUpdate)
geolocation:addEventListener(Event.HEADING_UPDATE, onHeadingUpdate)
geolocation:start()
MethodsGeolocation.getAccuracy returns the previously set desired accuracy |
EventsEvent.ERROR Constants |