Runtime Environment
1. Checking the running platform (getPlatformOS)
getPlatformOSis a function that checks the currently running platform. react-nativeof Platform.OS It operates based on the value, ios or android and returns one of the strings.
Signature
function getPlatformOS(): 'ios' | 'android';Return value
'ios' | 'android'
the currently running platform
Example
import { getPlatformOS } from '@apps-in-toss/framework';
import { Text } from 'react-native';
function Page() {
const platform = getPlatformOS();
return <Text>Current platform: {platform}</Text>;
}2. Checking the application environment (getOperationalEnvironment)
getOperationalEnvironment Use the function to check which deployment environment the app is currently running in (e.g.: sandbox, Toss) you can check whether it is running there. If it's running in the Toss app, 'toss', and if it's running in a sandbox environment, 'sandbox'is returned.
The operational environment refers to the context in which the app runs, and it can be used to determine whether specific features are available.
Signature
Return value
It is a string representing the current operational environment.
'toss' | 'sandbox'
'toss': Running in the Toss app.'sandbox': Running in the sandbox environment.
Example
Some features may need to be provided only in specific deployment environments. Below is sandbox an example of providing special features only in a given environment.
3. Checking the device's unique identifier (getDeviceId)
getDeviceId The function returns the unique identifier of the device being used as a string. It can be used to save settings or data per device, or to identify the user's device for logging and analysis. It's also useful for distinguishing multiple devices used by the same user.
Signature
Return value
string
It is a string representing the device's unique identifier.
Example
4. Getting the scheme value (getSchemeUri)
getSchemeUrireturns the scheme value used when the screen was first entered. URI changes caused by page navigation are not reflected.
Signature
Return value
string
It returns the scheme value used when the screen was first entered.
Example
Last updated
Was this helpful?