# journey.hardware

<table><thead><tr><th width="250">Property</th><th width="395.59370596524184">Description</th><th>Example</th></tr></thead><tbody><tr><td><code>getCurrentLocation</code></td><td><p>Returns the device's current GPS location as a <a href="../../../data-model-configuration/model/field#gps-location-location"><code>location</code></a> object. </p><p></p><p><strong>Note</strong>: This feature was introduced in version <strong>4.81.1</strong> of the JourneyApps Runtime.</p></td><td><a href="#journey.hardware.getcurrentlocation">See below</a></td></tr><tr><td><code>scanBarcode</code></td><td><p>Launches the <a href="../../ui-components/all-ui-components/scan-barcode">barcode scanner</a> programmatically. </p><p></p><p>Accepts the following optional parameters: </p><ul><li><code>types</code> - <a href="../../../ui-components/all-ui-components/scan-barcode#types">One or more supported barcode types</a></li><li><code>extensions</code> - <a href="../../../ui-components/all-ui-components/scan-barcode#extensions">One or more supported barcode extensions</a></li><li><code>prompt</code> - See details <a href="../../../ui-components/all-ui-components/scan-barcode#prompt">here</a></li><li><code>allowManualEntry</code> - See details <a href="../../../ui-components/all-ui-components/scan-barcode#allow-manual-entry">here</a></li></ul><p><strong>Note</strong>: This feature was introduced in version <strong>4.81.1</strong> of the JourneyApps Runtime.</p></td><td><a href="#journey.hardware.getcurrentlocation-1">See below</a></td></tr></tbody></table>

### Examples

#### `journey.hardware.getCurrentLocation`

{% hint style="warning" %}
**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.
{% endhint %}

{% code title="main.ts" %}

```javascript
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"}
}
```

{% endcode %}

#### `journey.hardware.scanBarcode`

{% code title="main.ts" %}

```javascript
async function scanBarcode() {
    view.barcode = await journey.hardware.scanBarcode({types: ['QR_CODE']});
}
```

{% endcode %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.journeyapps.com/reference/build/js-ts-apis/journey/journey.hardware.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
