Difference between revisions of "Geolocation"

From GiderosMobile
m (Text replacement - "<source" to "<syntaxhighlight")
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
<languages />
 
 
<!-- GIDEROSOBJ:Geolocation -->
 
<!-- GIDEROSOBJ:Geolocation -->
'''<translate>Supported platforms</translate>:''' [[File:Platform android.png]][[File:Platform ios.png]][[File:Platform winrt.png]]<br/>
+
'''Supported platforms:''' [[File:Platform android.png]][[File:Platform ios.png]][[File:Platform winrt.png]]<br/>
'''<translate>Available since</translate>:''' Gideros 2012.8<br/>
+
'''Available since:''' Gideros 2012.8<br/>
'''<translate>Inherits from</translate>:''' [[Special:MyLanguage/Object|Object]]<br/>
+
'''Inherits from:''' [[Object]]<br/>
  
=== <translate>Description</translate> ===
+
=== Description ===
The [[Special:MyLanguage/Geolocation|Geolocation]] class is used to configure the parameters and dispatching of location and heading related events.
+
The '''Geolocation''' Class is used to configure the parameters and dispatching of location and heading related events.
  
=== <translate>Examples</translate> ===
+
=== Examples ===
 
<syntaxhighlight lang="lua">
 
<syntaxhighlight lang="lua">
 
geolocation = Geolocation.new()
 
geolocation = Geolocation.new()
Line 24: Line 23:
 
geolocation:addEventListener(Event.HEADING_UPDATE, onHeadingUpdate)
 
geolocation:addEventListener(Event.HEADING_UPDATE, onHeadingUpdate)
 
geolocation:start()
 
geolocation:start()
</source>
+
</syntaxhighlight>
  
 
{|-
 
{|-
 
| style="width: 50%; vertical-align:top;"|
 
| style="width: 50%; vertical-align:top;"|
=== <translate>Methods</translate> ===
+
=== Methods ===
[[Special:MyLanguage/Geolocation.getAccuracy|Geolocation.getAccuracy]] ''<translate>returns the previously set desired accuracy</translate>''<br/>
+
[[Geolocation.getAccuracy]] ''returns the previously set desired accuracy''<br/><!--GIDEROSMTD:Geolocation.getAccuracy() returns the previously set desired accuracy-->
<!-- GIDEROSMTD:Geolocation.getAccuracy() returns the previously set desired accuracy -->
+
[[Geolocation.getThreshold]] ''returns the previously set minimum distance threshold''<br/><!--GIDEROSMTD:Geolocation.getThreshold() returns the previously set minimum distance threshold-->
[[Special:MyLanguage/Geolocation.getThreshold|Geolocation.getThreshold]] ''<translate>returns the previously set minimum distance threshold</translate>''<br/>
+
[[Geolocation.isAvailable]] ''does this device have the capability to determine current location?''<br/><!--GIDEROSMTD:Geolocation.isAvailable() does this device have the capability to determine current location?-->
<!-- GIDEROSMTD:Geolocation.getThreshold() returns the previously set minimum distance threshold -->
+
[[Geolocation.isHeadingAvailable]] ''does this device have the capability to determine heading?''<br/><!--GIDEROSMTD:Geolocation.isHeadingAvailable() does this device have the capability to determine heading?-->
[[Special:MyLanguage/Geolocation.isAvailable|Geolocation.isAvailable]] ''<translate>does this device have the capability to determine current location?</translate>''<br/>
+
[[Geolocation.new]] ''creates new Geolocation instance''<br/><!--GIDEROSMTD:Geolocation.new() creates new Geolocation instance-->
<!-- GIDEROSMTD:Geolocation.isAvailable() does this device have the capability to determine current location? -->
+
[[Geolocation.setAccuracy]] ''sets the accuracy of the location data''<br/><!--GIDEROSMTD:Geolocation.setAccuracy(accuracy) sets the accuracy of the location data-->
[[Special:MyLanguage/Geolocation.isHeadingAvailable|Geolocation.isHeadingAvailable]] ''<translate>does this device have the capability to determine heading?</translate>''<br/>
+
[[Geolocation.setThreshold]] ''sets the threshold''<br/><!--GIDEROSMTD:Geolocation.setThreshold(threshold) sets the threshold-->
<!-- GIDEROSMTD:Geolocation.isHeadingAvailable() does this device have the capability to determine heading? -->
 
[[Special:MyLanguage/Geolocation.new|Geolocation.new]] ''<translate>creates new Geolocation instance</translate>''<br/>
 
<!-- GIDEROSMTD:Geolocation.new() creates new Geolocation instance -->
 
[[Special:MyLanguage/Geolocation.setAccuracy|Geolocation.setAccuracy]] ''<translate>sets the accuracy of the location data</translate>''<br/>
 
<!-- GIDEROSMTD:Geolocation.setAccuracy(accuracy) sets the accuracy of the location data -->
 
[[Special:MyLanguage/Geolocation.setThreshold|Geolocation.setThreshold]] ''<translate>sets the threshold</translate>''<br/>
 
<!-- GIDEROSMTD:Geolocation.setThreshold(threshold) sets the threshold -->
 
  
[[Special:MyLanguage/Geolocation:start|Geolocation:start]] ''<translate>starts the generation of updates that report the current location and heading</translate>''<br/>
+
[[Geolocation:start]] ''starts the generation of updates that report the current location and heading''<br/><!--GIDEROSMTD:Geolocation:start() starts the generation of updates that report the current location and heading-->
<!-- GIDEROSMTD:Geolocation:start() starts the generation of updates that report the current location and heading -->
+
[[Geolocation:startUpdatingHeading]] ''starts the generation of updates that report the heading''<br/><!--GIDEROSMTD:Geolocation:startUpdatingHeading() starts the generation of updates that report the heading-->
[[Special:MyLanguage/Geolocation:startUpdatingHeading|Geolocation:startUpdatingHeading]] ''<translate>starts the generation of updates that report the heading</translate>''<br/>
+
[[Geolocation:startUpdatingLocation]] ''starts the generation of updates that report the current location''<br/><!--GIDEROSMTD:Geolocation:startUpdatingLocation() starts the generation of updates that report the current location-->
<!-- GIDEROSMTD:Geolocation:startUpdatingHeading() starts the generation of updates that report the heading -->
+
[[Geolocation:stop]] ''stops the generation of updates that report the current location and heading''<br/><!--GIDEROSMTD:Geolocation:stop() stops the generation of updates that report the current location and heading-->
[[Special:MyLanguage/Geolocation:startUpdatingLocation|Geolocation:startUpdatingLocation]] ''<translate>starts the generation of updates that report the current location</translate>''<br/>
+
[[Geolocation:stopUpdatingHeading]] ''stops the generation of updates that report the heading''<br/><!--GIDEROSMTD:Geolocation:stopUpdatingHeading() stops the generation of updates that report the heading-->
<!-- GIDEROSMTD:Geolocation:startUpdatingLocation() starts the generation of updates that report the current location -->
+
[[Geolocation:stopUpdatingLocation]] ''stops the generation of updates that report the current location''<br/><!--GIDEROSMTD:Geolocation:stopUpdatingLocation() stops the generation of updates that report the current location-->
[[Special:MyLanguage/Geolocation:stop|Geolocation:stop]] ''<translate>stops the generation of updates that report the current location and heading</translate>''<br/>
 
<!-- GIDEROSMTD:Geolocation:stop() stops the generation of updates that report the current location and 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 -->
 
  
 
| style="width: 50%; vertical-align:top;"|
 
| style="width: 50%; vertical-align:top;"|
=== <translate>Events</translate> ===
+
=== Events ===
[[Special:MyLanguage/Event.ERROR|Event.ERROR]]<br/>
+
[[Event.ERROR]]<br/><!--GIDEROSEVT:Event.ERROR error-->
<!-- GIDEROSEVT:Event.ERROR error -->
+
[[Event.HEADING_UPDATE]]<br/><!--GIDEROSEVT:Event.HEADING_UPDATE headingUpdate-->
[[Special:MyLanguage/Event.HEADING_UPDATE|Event.HEADING_UPDATE]]<br/>
+
[[Event.LOCATION_UPDATE]]<br/><!--GIDEROSEVT:Event.LOCATION_UPDATE locationUpdate-->
<!-- GIDEROSEVT:Event.HEADING_UPDATE headingUpdate -->
+
=== Constants ===
[[Special:MyLanguage/Event.LOCATION_UPDATE|Event.LOCATION_UPDATE]]<br/>
 
<!-- GIDEROSEVT:Event.LOCATION_UPDATE locationUpdate -->
 
=== <translate>Constants</translate> ===
 
 
|}
 
|}
  
 
{{GIDEROS IMPORTANT LINKS}}
 
{{GIDEROS IMPORTANT LINKS}}

Latest revision as of 06:54, 10 October 2023

Supported platforms: Platform android.pngPlatform ios.pngPlatform winrt.png
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()

Methods

Geolocation.getAccuracy returns the previously set desired accuracy
Geolocation.getThreshold returns the previously set minimum distance threshold
Geolocation.isAvailable does this device have the capability to determine current location?
Geolocation.isHeadingAvailable does this device have the capability to determine heading?
Geolocation.new creates new Geolocation instance
Geolocation.setAccuracy sets the accuracy of the location data
Geolocation.setThreshold sets the threshold

Geolocation:start starts the generation of updates that report the current location and heading
Geolocation:startUpdatingHeading starts the generation of updates that report the heading
Geolocation:startUpdatingLocation starts the generation of updates that report the current location
Geolocation:stop stops the generation of updates that report the current location and heading
Geolocation:stopUpdatingHeading stops the generation of updates that report the heading
Geolocation:stopUpdatingLocation stops the generation of updates that report the current location

Events

Event.ERROR
Event.HEADING_UPDATE
Event.LOCATION_UPDATE

Constants