journey.hardware
Property
Description
Example
getCurrentLocation
Returns the device's current GPS location as a location
object.
Note: This feature was introduced in version 4.81.1 of the JourneyApps Runtime.
scanBarcode
Launches the barcode scanner programmatically.
Accepts the following optional parameters:
extensions
- One or more supported barcode extensionsprompt
- See details hereallowManualEntry
- See details here
Note: This feature was introduced in version 4.81.1 of the JourneyApps Runtime.
Examples
journey.hardware.getCurrentLocation
journey.hardware.getCurrentLocation
Limitation
Capturing the altitude
and/or vertical_accuracy
is not supported on several platforms / devices, including Android devices. These devices will return undefined
or null
for these fields.
async function init() {
var currentLocation = await journey.hardware.getCurrentLocation();
console.log(currentLocation);
// {latitude: -33.9002979, longitude: 18.847503, altitude: undefined, horizontal_accuracy: 28.622, vertical_accuracy: undefined, timestamp: "2022-10-31T09:48:21Z"}
}
journey.hardware.scanBarcode
journey.hardware.scanBarcode
async function scanBarcode() {
view.barcode = await journey.hardware.scanBarcode({types: ['QR_CODE']});
}
Last updated