Difference between revisions of "Geolocation"
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
+ | '''Supported platforms:''' [[File:Platform android.png]][[File:Platform ios.png]][[File:Platform winrt.png]]<br/> | ||
+ | '''Available since:''' Gideros 2012.8<br/> | ||
+ | '''Inherits from:''' [[Object]]<br/> | ||
+ | |||
+ | === Description === | ||
+ | The [[Geolocation]] class is used to configure the parameters and dispatching of location and heading related events. | ||
+ | |||
+ | === Examples === | ||
+ | |||
+ | <source lang="lua"> | ||
+ | geolocation = Geolocation.new() | ||
local function onLocationUpdate(event) | local function onLocationUpdate(event) | ||
print("location: ", event.latitude, event.longitude, event.altitude) | print("location: ", event.latitude, event.longitude, event.altitude) | ||
Line 23: | Line 22: | ||
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;"| | ||
− | === | + | |
− | [[ | + | === Methods === |
− | [[ | + | [[Geolocation.getAccuracy]] ''returns the previously set desired accuracy''<br/> |
− | [[ | + | [[Geolocation.getThreshold]] ''returns the previously set minimum distance threshold''<br/> |
− | [[ | + | [[Geolocation.isAvailable]] ''does this device have the capability to determine current location?''<br/> |
− | [[ | + | [[Geolocation.isHeadingAvailable]] ''does this device have the capability to determine heading?''<br/> |
− | [[ | + | [[Geolocation.new]] ''Creates new Geolocation instance''<br/> |
− | [[ | + | [[Geolocation.setAccuracy]] ''of the location data''<br/> |
− | [[ | + | [[Geolocation.setThreshold]] ''threshold''<br/> |
− | [[ | + | [[Geolocation:start]] ''starts the generation of updates that report the current location and heading''<br/> |
− | [[ | + | [[Geolocation:startUpdatingHeading]] ''starts the generation of updates that report the heading''<br/> |
− | [[ | + | [[Geolocation:startUpdatingLocation]] ''starts the generation of updates that report the current location''<br/> |
− | [[ | + | [[Geolocation:stop]] ''stops the generation of updates that report the current location and heading''<br/> |
− | [[ | + | [[Geolocation:stopUpdatingHeading]] ''stops the generation of updates that report the heading''<br/> |
+ | [[Geolocation:stopUpdatingLocation]] ''stops the generation of updates that report the current location''<br/> | ||
+ | |||
| style="width: 50%; vertical-align:top;"| | | style="width: 50%; vertical-align:top;"| | ||
− | === | + | |
− | [[ | + | === Events === |
− | [[ | + | [[Event.ERROR]]<br/> |
− | [[ | + | [[Event.HEADING_UPDATE]]<br/> |
− | === | + | [[Event.LOCATION_UPDATE]]<br/> |
+ | |||
+ | === Constants === | ||
+ | |||
|} | |} | ||
+ | |||
+ | ---- | ||
+ | {{Special:PrefixIndex/Geolocation}} | ||
+ | <br/> | ||
+ | |||
+ | {{Special:PrefixIndex/Event.ERROR}} | ||
+ | {{Special:PrefixIndex/Event.HEADING_UPDATE}} | ||
+ | {{Special:PrefixIndex/Event.LOCATION_UPDATE}} | ||
+ | <br/> |
Revision as of 23:22, 2 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 |
- Geolocation
- Geolocation.getAccuracy
- Geolocation.getThreshold
- Geolocation.isAvailable
- Geolocation.isHeadingAvailable
- Geolocation.new
- Geolocation.setAccuracy
- Geolocation.setThreshold
- Geolocation:start
- Geolocation:startUpdatingHeading
- Geolocation:startUpdatingLocation
- Geolocation:stop
- Geolocation:stopUpdatingHeading
- Geolocation:stopUpdatingLocation