Difference between revisions of "Geolocation"

(Undo revision 13731 by MoKaLux (talk))
(Tag: Undo)
(One intermediate revision by the same user not shown)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
 +
<languages />
 +
<!-- GIDEROSOBJ:Geolocation -->
 +
'''<translate>Supported platforms</translate>:''' [[File:Platform android.png]][[File:Platform ios.png]][[File:Platform winrt.png]]<br/>
 +
'''<translate>Available since</translate>:''' Gideros 2012.8<br/>
 +
'''<translate>Inherits from</translate>:''' [[Special:MyLanguage/Object|Object]]<br/>
 +
=== <translate>Description</translate> ===
 +
<translate><br />
 +
The [[Special:MyLanguage/Geolocation|Geolocation]] class is used to configure the parameters and dispatching of location and heading related events.<br />
 +
<br /></translate>
 +
=== <translate>Examples</translate> ===
 +
'''Example'''<br/>
 +
<source lang="lua">geolocation = Geolocation.new()
  
'''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 22: 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()
+
geolocation:start()</source>
</source>
 
 
 
 
{|-
 
{|-
 
 
| 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/><!-- GIDEROSMTD:Geolocation.getAccuracy() returns the previously set desired accuracy -->
[[Geolocation.getAccuracy]] ''returns the previously set desired accuracy''<br/>
+
[[Special:MyLanguage/Geolocation.getThreshold|Geolocation.getThreshold]] ''<translate>returns the previously set minimum distance threshold</translate>''<br/><!-- GIDEROSMTD:Geolocation.getThreshold() returns the previously set minimum distance threshold -->
[[Geolocation.getThreshold]] ''returns the previously set minimum distance threshold''<br/>
+
[[Special:MyLanguage/Geolocation.isAvailable|Geolocation.isAvailable]] ''<translate>does this device have the capability to determine current location?</translate>''<br/><!-- GIDEROSMTD:Geolocation.isAvailable() does this device have the capability to determine current location? -->
[[Geolocation.isAvailable]] ''does this device have the capability to determine current location?''<br/>
+
[[Special:MyLanguage/Geolocation.isHeadingAvailable|Geolocation.isHeadingAvailable]] ''<translate>does this device have the capability to determine heading?</translate>''<br/><!-- GIDEROSMTD:Geolocation.isHeadingAvailable() does this device have the capability to determine heading? -->
[[Geolocation.isHeadingAvailable]] ''does this device have the capability to determine heading?''<br/>
+
[[Special:MyLanguage/Geolocation.new|Geolocation.new]] ''<translate>Creates new Geolocation instance</translate>''<br/><!-- GIDEROSMTD:Geolocation.new() Creates new Geolocation instance -->
[[Geolocation.new]] ''Creates new Geolocation instance''<br/>
+
[[Special:MyLanguage/Geolocation.setAccuracy|Geolocation.setAccuracy]] ''<translate>of the location data</translate>''<br/><!-- GIDEROSMTD:Geolocation.setAccuracy(accuracy) of the location data -->
[[Geolocation.setAccuracy]] ''of the location data''<br/>
+
[[Special:MyLanguage/Geolocation.setThreshold|Geolocation.setThreshold]] ''<translate>threshold</translate>''<br/><!-- GIDEROSMTD:Geolocation.setThreshold(threshold) threshold -->
[[Geolocation.setThreshold]] ''threshold''<br/>
+
[[Special:MyLanguage/Geolocation:start|Geolocation:start]] ''<translate>starts the generation of updates that report the current location and heading</translate>''<br/><!-- GIDEROSMTD:Geolocation:start() starts the generation of updates that report the current location and heading -->
[[Geolocation:start]] ''starts the generation of updates that report the current location and heading''<br/>
+
[[Special:MyLanguage/Geolocation:startUpdatingHeading|Geolocation:startUpdatingHeading]] ''<translate>starts the generation of updates that report the heading</translate>''<br/><!-- GIDEROSMTD:Geolocation:startUpdatingHeading() starts the generation of updates that report the heading -->
[[Geolocation:startUpdatingHeading]] ''starts the generation of updates that report the heading''<br/>
+
[[Special:MyLanguage/Geolocation:startUpdatingLocation|Geolocation:startUpdatingLocation]] ''<translate>starts the generation of updates that report the current location</translate>''<br/><!-- GIDEROSMTD:Geolocation:startUpdatingLocation() starts the generation of updates that report the current location -->
[[Geolocation:startUpdatingLocation]] ''starts the generation of updates that report the current location''<br/>
+
[[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 -->
[[Geolocation:stop]] ''stops the generation of updates that report the current location and heading''<br/>
+
[[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 -->
[[Geolocation:stopUpdatingHeading]] ''stops the generation of updates that report the heading''<br/>
+
[[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 -->
[[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;"|
 
+
=== <translate>Events</translate> ===
=== Events ===
+
[[Special:MyLanguage/Event.ERROR|Event.ERROR]]<br/><!-- GIDEROSEVT:Event.ERROR error-->
[[Event.ERROR]]<br/>
+
[[Special:MyLanguage/Event.HEADING_UPDATE|Event.HEADING_UPDATE]]<br/><!-- GIDEROSEVT:Event.HEADING_UPDATE headingUpdate-->
[[Event.HEADING_UPDATE]]<br/>
+
[[Special:MyLanguage/Event.LOCATION_UPDATE|Event.LOCATION_UPDATE]]<br/><!-- GIDEROSEVT:Event.LOCATION_UPDATE locationUpdate-->
[[Event.LOCATION_UPDATE]]<br/>
+
=== <translate>Constants</translate> ===
 
 
=== Constants ===
 
 
 
 
|}
 
|}
 
{{Geolocation}}
 

Revision as of 11:15, 4 December 2019


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

Example

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 of the location data
Geolocation.setThreshold 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