A Location field allows the user to provide their location as a form of data collection. Whilst an Orientation field records the device’s orientation at a precise point in time.

Location

The Location field can collect the latitude, longitude, altitude, bearing and speed from a user’s device.

There are many attributes that you can include within the Location tag for it to collect the data you are looking for, click here for a full list of these attributes.

For example, you can decide whether the app should determine the user’s location using GPS, from the network location provider or from both. GPS uses more battery power but is also more accurate than the network location provider. You can also determine whether to start listening for the device’s location when the user enters the Form rather than when the user reaches the Location field. You can also specify for a certain accuracy radius and recency, whereby inadequate location readings will be disregarded:

In the above example, a Location field named “Position” will be created and GPS would be used to determine the device’s location. The attribute startWith=”form” means that the app will start listening for the device’s location as soon as the user enters the Form. The Location tag also includes a maximum accuracy radius of 30 metres before the data is deemed too inaccurate to record, as well as a maximum age of 1 minute before the location data is deemed too old to record.

 

In the ideal case that the device has already found a location by the time the user reaches the Location field, the “wait for location” screen demonstrated on the left will not be shown. Instead, the location will be recorded and the app will move on to the next screen. If the user’s device cannot find a location, the optional=”true” attribute can provide a skip button so that the user can skip to the next section of the project. Please note that no location will be recorded in this case.

Therefore, if  you are creating a project that MUST have a location associated with each record, you should put the attribute optional=”false”. Alternatively, if you want to record information where the geolocation would be ‘nice to have’, you can put optional=”true”.

Orientation

When the user reaches the Orientation field, the device’s orientation – including its pitch, roll and azimuth – will be recorded:

  • Pitch is the rotation around the X axis, varying from -90° to 90°. 90° means the device is pointed to the ground, -90° means it the device is pointed to the sky.
  • Roll is the rotation around the Y axis, varying from -180° to 180°. 0° means the device is lying on its back (screen facing upwards), (-)180° means it is lying on its ‘face’ (screen facing downwards).
  • Azimuth is the rotation around the Z axis, varying from 0° to 360°. 0° means the top of the device is pointing to magnetic North.

Consult the Android Developer documentation for more information on orientation sensing.

The example code above describes a non-optional Orientation field with ID “orientationField” in which the device’s azimuth and roll are stored but the pitch is not.

Click here to see the full list of attributes that you can include within the Orientation tag.