getPlatformOS
Synchronously returns the platform OS the mini-app is running on. Based on React Native's Platform.OS, it returns either 'ios' or 'android'.
Signature
import { getPlatformOS } from '@apps-in-toss/web-framework';
declare function getPlatformOS(): 'ios' | 'android';
Parameters
None.
Returns
'ios'— currently running on iOS.'android'— currently running on Android.
Permission
No permission required — getPlatformOS is not bound to a PermissionName. For the typical permission flow used by other namespaces, see Guides — Permissions pattern.
Examples
Minimal
import { getPlatformOS } from '@apps-in-toss/web-framework';
const platform = getPlatformOS();
console.log('Platform:', platform); // 'ios' or 'android'
Realistic — platform-specific styles
import { getPlatformOS } from '@apps-in-toss/web-framework';
function PlatformSpecificButton() {
const platform = getPlatformOS();
const isIos = platform === 'ios';
return (
<button
type="button"
style={{
// Rounded on iOS, Material style on Android
borderRadius: isIos ? 22 : 4,
fontFamily: isIos ? '-apple-system' : 'Roboto, sans-serif',
padding: '12px 24px',
}}
>
{isIos ? 'iOS-style button' : 'Android-style button'}
</button>
);
}
Try it live
Open the Environment page in sdk-example and run the getPlatformOS card to inspect the result.
Related APIs
getOperationalEnvironment— returns the execution environment (toss/sandbox).getTossAppVersion— returns the Toss app version.isMinVersionSupported— checks per-platform minimum version requirements.
Related guides
- Guides — Permissions pattern — permission flow used by other namespaces (reference only;
getPlatformOSdoesn't require a permission). - Recipes — Platform-based UI branching (iOS vs Android)
External references
@apps-in-toss/web-framework— SDK package. The actual exports are re-exported from@apps-in-toss/web-bridge.- React Native
Platform.OS— this function internally wrapsPlatform.OS. - Web standard counterpart:
navigator.userAgentData.platform— browser-based platform detection, but less reliable thangetPlatformOS()in the mini-app runtime.