> For the complete documentation index, see [llms.txt](https://developers-apps-in-toss.toss.im/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers-apps-in-toss.toss.im/documentation/api-and-sdk-en/react-native/location.md).

# Location

### Detecting location info changes

**SDK Hook:** `useGeolocation`

`useGeolocation`This is a hook that returns the device's location information. When the location changes, the value changes too. It uses GPS information to detect the current location and automatically updates as the user moves. For example, it can be used to display the user's current location in a map-based service or to track a real-time delivery route in a delivery app. You can adjust the accuracy and update interval of the location information, so you can maintain the required level of accuracy while minimizing battery consumption.

**Signature**

```typescript
function useGeolocation({ accuracy, distanceInterval, timeInterval }: UseGeolocationOptions): Location | null;
```

**Parameters**

* **options** · Required · `UseGeolocationOptions`

  This is the configuration object required for location detection.

  * **options.accuracy** · `Accuracy`

    Sets the location accuracy. `Accuracy.Lowest`: within an error range of 3 km, `Accuracy.Low`: within an error range of 1 km, `Accuracy.Balanced`: within an error range of a few hundred meters, `Accuracy.High`: within an error range of 10 m, `Accuracy.Highest`: highest accuracy, `Accuracy.BestForNavigation`: best accuracy for navigation
  * **options.timeInterval** · `number`

    The minimum interval for updating location information, in milliseconds (ms). This sets the shortest gap at which location updates can occur, but depending on the system or environment, updates may happen at longer intervals than specified.
  * **options.distanceInterval** · `number`

    Sets the distance threshold for location changes in meters (m).

**Return value**

* Location | null

  Returns an object containing the device's location information. For more details, see [Location](/documentation/api-and-sdk-en/common/permission/location.md)please refer to

**Example**

**Displaying location information on the screen**

```tsx
import React, { useState, useCallback } from 'react';
import { View, Text } from 'react-native';
import { useGeolocation, Accuracy } from '@apps-in-toss/framework';

// Detecting location info changes
function LocationWatcher() {
  const location = useGeolocation({
    accuracy: Accuracy.Balanced,
    distanceInterval: 10,
    timeInterval: 1000,
  });

  if (location == null) {
    return <Text>Fetching location information...</Text>;
  }

  return (
    <View>
      <Text>
        Location: {location.latitude}, {location.longitude}
      </Text>
    </View>
  );
}
```

**Try the example app**

[apps-in-toss-examples](https://github.com/toss/apps-in-toss-examples) from the repository [with-location-tracking](https://github.com/toss/apps-in-toss-examples/tree/main/with-location-tracking) Download the code, or scan the QR code below to try it yourself.

QR code link: intoss\://with-location-tracking


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://developers-apps-in-toss.toss.im/documentation/api-and-sdk-en/react-native/location.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
