> 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/common/network-environment/environment.md).

# Runtime environment

### 1. Check the current running platform (`getPlatformOS`)

`getPlatformOS` is a function that checks the current running platform. `react-native`the [`Platform.OS`](https://reactnative.dev/docs/0.72/platform#os) based on the value, `ios` or `android` returns a string of one of

**Signature**

```typescript
function getPlatformOS(): 'ios' | 'android';
```

**Return value**

* 'ios' | 'android'

  Current running platform

**Example**

```tsx
import { getPlatformOS } from '@apps-in-toss/framework';
import { Text } from 'react-native';

function Page() {
  const platform = getPlatformOS();

  return <Text>Current platform: {platform}</Text>;
}
```

***

### 2. Check the application environment (`getOperationalEnvironment`)

`getOperationalEnvironment` With the function, you can check which deployment environment the app is currently running in (e.g.: `sandbox`, `toss`) If it's running in the Toss app, `'toss'`, if it's running in a sandbox environment, `'sandbox'`is returned.

The operational environment refers to the context in which the app is running, and it can be used to determine whether specific features are available.

**Signature**

```typescript
function getOperationalEnvironment(): 'toss' | 'sandbox';
```

**Return value**

This is a string that indicates the current operational environment.

* 'toss' | 'sandbox'

  `'toss'`: It's running in the Toss app. `'sandbox'`: It's running in the sandbox environment.

**Example**

{% tabs %}
{% tab title="js" %}

```js
import { getOperationalEnvironment } from '@apps-in-toss/web-framework';

const environment = getOperationalEnvironment();
```

{% endtab %}

{% tab title="React" %}

```tsx
import { getOperationalEnvironment } from '@apps-in-toss/web-framework';
import { Text } from '@toss/tds-mobile';

function EnvironmentInfo() {
  const environment = getOperationalEnvironment();

  return <Text>{`The current execution environment is '${environment}'.`}</Text>;
}
```

{% endtab %}

{% tab title="React Native" %}

```tsx
import { getOperationalEnvironment } from '@apps-in-toss/framework';
import { Text } from '@toss/tds-react-native';

function EnvironmentInfo() {
  const environment = getOperationalEnvironment();

  return <Text>{`The current execution environment is '${environment}'.`}</Text>;
}
```

{% endtab %}
{% endtabs %}

There may be features that should only be provided in specific deployment environments. Below is `sandbox` an example of providing special features only in the

```tsx{4,8-9}
import { View, Text } from 'react-native';
import { getOperationalEnvironment } from '@apps-in-toss/framework';

const isSandbox = getOperationalEnvironment() === 'sandbox'; // variable to check whether it's the 'sandbox' environment

function Component() {
  const handlePress = () => {
    if (isSandbox) {
      // features provided in the 'sandbox' environment
    } else {
      // features provided in other environments
    }
  };

  return <Button onPress={handlePress}>View details</Button>;
}
```

***

### 3. Check device unique identifier (`getDeviceId`)

`getDeviceId` The function returns the unique identifier of the device in use as a string. It can be used to store settings or data by device, or to identify the user's device for logging and analytics. It is also useful for distinguishing multiple devices used by the same user.

**Signature**

```typescript
function getDeviceId(): string;
```

**Return value**

* string

  This is a string representing the device's unique identifier.

**Example**

{% tabs %}
{% tab title="js" %}

```js
import { getDeviceId } from '@apps-in-toss/web-framework';

const deviceId = getDeviceId();
```

{% endtab %}

{% tab title="React" %}

```tsx
import { getDeviceId } from '@apps-in-toss/web-framework';
import { useState } from 'react';

const DeviceInfo = () => {
  const [deviceId, setDeviceId] = useState<string | null>(null);

  const fetchDeviceId = async () => {
    setDeviceId(getDeviceId());
  };

  return (
    <div>
      <button onClick={fetchDeviceId}>Get device ID</button>
      {deviceId && <p>Device ID: {deviceId}</p>}

  );
};
```

{% endtab %}

{% tab title="React Native" %}

```tsx
import { getDeviceId } from '@apps-in-toss/framework';
import { Text } from '@toss/tds-react-native';

function MyPage() {
  const id = getDeviceId();

  return <Text>User's device unique identifier: {id}</Text>;
}
```

{% endtab %}
{% endtabs %}

***

### 4. Get scheme value (`getSchemeUri`)

`getSchemeUri`returns the scheme value that was initially entered on the screen. URI changes caused by page navigation are not reflected.

**Signature**

```typescript
function getSchemeUri(): string;
```

**Return value**

* string

  Returns the scheme value that was initially entered on the screen.

**Example**

```tsx
import { getSchemeUri } from '@apps-in-toss/framework';
import { Text } from 'react-native';

function MyPage() {
  const schemeUri = getSchemeUri();

  return <Text>Initial scheme value entered on the screen: {schemeUri}</Text>;
}
```


---

# 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/common/network-environment/environment.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.
