You are viewing the Resources for the older version of JourneyApps (V3). JourneyApps V4 is the new default for all new apps since July 1, 2016.

All View Components → gps

Select a view component to see details on how it works:

gps

An input component that allows the user to capture their current GPS location.

Tutorial

The GPS Capturing section of the How to Build Apps tutorial provides more detail on how to capture GPS locations in your JourneyApps application.

Read It Now

Example — "Foreground" Capturing

The following example shows how GPS location capturing can be performed in the "foreground" i.e. the user sees a map showing how their GPS location is captured.

Code in View XML:

Appearance on mobile device:

Example — "Background" Capturing

Using the show-if configuration option, it is also possible to capture a GPS location in the background (i.e. the map pictured in the screenshot above is not shown)

Appearance on mobile device:

Configuration:

Option Required? Details
bind required Variable/attribute in which to store the GPS location captured.
Must be a variable or attribute of type location
(see Attribute & Variable Types for more details)
label optional Text to display above the date input. It can be a Format String to make the text dynamic.
required optional true if a GPS location must be taken before proceeding to another view. Defaults to false.
show-if optional Controls whether the component is hidden or shown. The argument specified to show-if must be a literal boolean value (true or false) (this only applies to the GPS component). Refer to the section Show/Hide Components Dynamically for more details.
hide-if optional The opposite of show-if (see above).

Accessing Coordinates, Accuracy, etc. from JavaScript

JourneyApps supports accessing GPS latitude, longitude and accuracy information in the location attribute or variable that you're storing the captured GPS location. Refer to the GPS Capturing section for more information.