# Location Sensor

![](https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LAn5scXl2uqUJUOqkJo%2F-LAn5wecEraNWaG7Ig2g%2F-LAn66OHeUWrLzEQSkVv%2Flocation-sensor-%E2%9C%95-fig-1.png?generation=1524497153338474\&alt=media)

## Adding a Location Sensor to your app

To add a Location Sensor to your app:

1. Navigate to the **Blocks** tab of your project.
2. Under the App Features heading, locate **Sensors**.&#x20;
3. Click the ⊕ symbol next to Sensor.
4. Select **Location Sensor** from the provided menu.
5. Click **Add**.

![](https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LAn5scXl2uqUJUOqkJo%2F-MMGsCOQmypJUYH0PDNJ%2F-MMGscus1Tmzgj_p_Z1B%2Fsensors.png?alt=media\&token=a7524d1d-1589-4802-94cb-df712fc62c3b)

![](https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LAn5scXl2uqUJUOqkJo%2F-MMGsCOQmypJUYH0PDNJ%2F-MMGtN30eJmSdWNKCxqJ%2Fsensor-options.png?alt=media\&token=131b3d8e-7da1-48d0-96d0-a05ecadbbf32)

You will see a settings panel where you can set the properties of the Location Sensor before clicking Submit.

## Properties

| Property           | Description                                                                                                      | Data Type  |
| ------------------ | ---------------------------------------------------------------------------------------------------------------- | ---------- |
| EnableHighAccuracy | Enables network provider that uses Google Play services to improve location accuracy and location-based services | True/False |
| Timeout            | How long the Lotion Sensor will look for the user's location before quitting, in milliseconds                    | Number     |
| Maximum Age        | How long a previously fetched location will remain valid, in milliseconds                                        | Number     |

## Blocks

### Functions

#### Get Current Location

![](https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LAn5scXl2uqUJUOqkJo%2F-MXHQKS_hSpM0RCb68kH%2F-MXHS5NJSN15G0XTWWTV%2Ff_loc_sensor.png?alt=media\&token=8fca43d4-dd6a-4339-88ab-22d8073875ae)

#### Properties

| Event / Property     | Description                                                                                                                                                                                                                                                              |
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Get Current Location | Returns a user's location in  `latitude` and `longitude` degrees; also includes additional information in a location object including i) estimated location `accuracy` in meters,  ii) `altitude` in meters, iii)  `speed` in meters/second and iv) `heading` in degrees |

#### Example

![](https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LAn5scXl2uqUJUOqkJo%2F-MXHQKS_hSpM0RCb68kH%2F-MXHRVyID36zSz_CMzda%2Flocation.png?alt=media\&token=be126a13-20b8-45c0-bd60-63f5bd4f07fc)

The Location Sensor returns a user's current location in `latitude` and `longitude` as well as a `location` object which includes additional properties like `accuracy`, `altitude`, `speed` and `heading` (or direction) which you have to retrieve with the object blocks above

### Properties

#### Enable High Accuracy&#x20;

![](https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LAn5scXl2uqUJUOqkJo%2F-MXHQKS_hSpM0RCb68kH%2F-MXHSDC0KECUsPzqBb-V%2Floc_EHA.png?alt=media\&token=02403d7b-4812-4fe0-ab1c-a6c2ea1a0d58)

#### Maximum Age&#x20;

![](https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LAn5scXl2uqUJUOqkJo%2F-MXHQKS_hSpM0RCb68kH%2F-MXHSVtlpzuYhC-OXyCz%2Floc_maxAge.png?alt=media\&token=4d02ca32-63e3-436b-be52-5e5fb79910f7)
