Skip to content

Location Sensor

Non-Visible component
Category Requires Version
Sensors API 21, Android 5.0 Lollipop 3

Overview

Non-visible component providing location information, including longitude, latitude, altitude (if supported by the device), speed (if supported by the device), and address. This can also perform "geocoding", converting a given address (not necessarily the current one) to a latitude (with the LatitudeFromAddress method) and a longitude (with the LongitudeFromAddress method).

In order to function, the component must have its Enabled property set to True, and the device must have location sensing enabled through wireless networks or GPS satellites (if outdoors).

Location information might not be immediately available when an app starts. You'll have to wait a short time for a location provider to be found and used, or wait for the OnLocationChanged event

Permissions

Events

Location Changed

Indicates that a new location has been detected.

Params
latitude Number
longitude Number
altitude Number
speed Number

Status Changed

Indicates that the status of the location provider service has changed, such as when aprovider is lost or a new provider starts being used.

Params
provider Text
status Text

Methods

Latitude From Address

Returns: Number

Derives latitude of given address

Params
location Name Text

Longitude From Address

Returns: Number

Derives longitude of given address

Params
location Name Text

Properties

Accuracy

Number ➖ Read - Blocks

The most recent measure of accuracy, in meters. If no value is available,0 will be returned.

Altitude

Number ➖ Read - Blocks

The most recently available altitude value, in meters. If no value isavailable, 0 will be returned.

Available Providers

List ➖ Read - Blocks

Property for AvailableProviders

Current Address

Text ➖ Read - Blocks

Provides a textual representation of the current address or"No address available".

Distance Interval

Number Default: 5 ➖ Read Write - Designer Blocks

Determines the minimum distance interval, in meters, that the sensor will try to use for sending out location updates. For example, if this is set to 5, then the sensor will fire a LocationChanged event only after 5 meters have been traversed. However, the sensor does not guarantee that an update will be received at exactly the distance interval. It may take more than 5 meters to fire an event, for instance.

Enabled

Boolean Default: True ➖ Read Write - Designer Blocks

Indicates whether the user has specified that the sensor shouldlisten for location changes and raise the corresponding events.

Has Accuracy

Boolean ➖ Read - Blocks

Indicates whether information about location accuracy is available.

Has Altitude

Boolean ➖ Read - Blocks

Indicates whether altitude information is available.

Has Longitude Latitude

Boolean ➖ Read - Blocks

Indicates whether longitude and latitude information is available. (It isalways the case that either both or neither are.)

Latitude

Number ➖ Read - Blocks

The most recently available latitude value. If no value is available,0 will be returned.

Longitude

Number ➖ Read - Blocks

The most recent available longitude value. If no value is available,0 will be returned.

Provider Locked

Boolean ➖ Read Write - Blocks

Indicates whether the sensor should allow the developer tomanually change the provider (GPS, GSM, Wifi, etc.)from which location updates are received.

Provider Name

Text ➖ Read Write - Blocks

Indicates the source of the location information. If there is no provider, thestring "NO PROVIDER" is returned. This is useful primarily for debugging.

Time Interval

Number Default: 60000 ➖ Read Write - Designer Blocks

Determines the minimum time interval, in milliseconds, that the sensor will try to use for sending out location updates. However, location updates will only be received when the location of the phone actually changes, and use of the specified time interval is not guaranteed. For example, if 1000 is used as the time interval, location updates will never be fired sooner than 1000ms, but they may be fired anytime after.


Last update: November 9, 2022