Getting Started
설치 단계와 이 플러그인의 전체 마크다운 가이드를 포함한 설정 프롬프트를 복사하세요.
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-screen-orientation`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/screen-orientation/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
설치
설치AI 도움을 받아 플러그인을 설치할 수 있습니다. AI 도구에 Capgo 스킬을 추가하려면 다음 명령어를 사용하세요:
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins그런 다음 다음 명령어를 사용하세요:
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-screen-orientation` plugin in my project.만약 Manual Setup을 선호한다면, 다음 명령어를 실행하고 아래의 플랫폼별 설명을 따라하세요:
bun add @capgo/capacitor-screen-orientationbunx cap syncImport
Import라는 제목의 섹션import { ScreenOrientation } from '@capgo/capacitor-screen-orientation';API 개요
API 개요라는 제목의 섹션orientation
__CAPGO_KEEP_0__라는 제목의 섹션현재 화면의 방향을 가져옵니다.
현재 디바이스 화면의 방향을 반환합니다.
import { ScreenOrientation } from '@capgo/capacitor-screen-orientation';
const result = await ScreenOrientation.orientation();console.log('Current orientation:', result.type);lock
‘잠금’ 제목 섹션특정 방향으로 화면 방향을 잠그세요.
화면을 지정된 방향으로 잠급니다. iOS에서 bypassOrientationLock이 true일 경우, motion sensors를 사용하여 물리적 디바이스 방향을 추적하기 시작합니다.
주의: 사용자 설정의 방향 잠금 설정을 존중합니다. 물리적 디바이스 방향 추적을 허용하여 UI가 회전하지 않아도 디바이스가 물리적으로 어떤 방향으로 잡혀 있는지 감지할 수 있습니다.
import { ScreenOrientation } from '@capgo/capacitor-screen-orientation';
// Standard lockawait ScreenOrientation.lock({ orientation: 'landscape' });
// Lock with motion tracking on iOSawait ScreenOrientation.lock({ orientation: 'portrait', bypassOrientationLock: true});unlock
‘해제’ 제목 섹션화면 방향을 해제하세요.
디바이스 위치에 따라 화면이 자유롭게 회전할 수 있습니다. 또한 motion-based orientation tracking이 활성화된 경우도 중지합니다.
import { ScreenOrientation } from '@capgo/capacitor-screen-orientation';
await ScreenOrientation.unlock();startOrientationTracking
‘방향 추적 시작’ 제목 섹션__CAPGO_KEEP_0__
__CAPGO_KEEP_0__
import { ScreenOrientation } from '@capgo/capacitor-screen-orientation';
await ScreenOrientation.startOrientationTracking({ bypassOrientationLock: true});
// Listen for changesScreenOrientation.addListener('screenOrientationChange', (result) => { console.log('Orientation changed:', result.type);});stopOrientationTracking
__CAPGO_KEEP_2____CAPGO_KEEP_0__
__CAPGO_KEEP_0__
import { ScreenOrientation } from '@capgo/capacitor-screen-orientation';
await ScreenOrientation.stopOrientationTracking();isOrientationLocked
__CAPGO_KEEP_3____CAPGO_KEEP_0__
__CAPGO_KEEP_4__
__CAPGO_KEEP_5__
import { ScreenOrientation } from '@capgo/capacitor-screen-orientation';
// Start motion tracking firstawait ScreenOrientation.startOrientationTracking({ bypassOrientationLock: true});
// Check lock statusconst status = await ScreenOrientation.isOrientationLocked();if (status.locked) { console.log('Orientation lock is ON'); console.log('Physical:', status.physicalOrientation); console.log('UI:', status.uiOrientation);}타입 참조
타입 참조 섹션ScreenOrientationResult
스크린 오리엔테이션 결과 섹션orientation() 메서드가 반환하는 결과.
export interface ScreenOrientationResult { /** * The current orientation type. * * @since 1.0.0 */ type: OrientationType;}OrientationLockOptions
스크린 오리엔테이션 잠금 옵션 섹션스크린 오리엔테이션 잠금 옵션
export interface OrientationLockOptions { /** * The orientation type to lock to. * * @since 1.0.0 */ orientation: OrientationLockType;
/** * Whether to track physical device orientation using motion sensors. * When true, uses device motion sensors to detect the true physical * orientation of the device, even when the device orientation lock is enabled. * * **Important:** This does NOT bypass the UI orientation lock. * The screen will still respect the user's orientation lock setting. * This option only affects orientation detection/tracking - you'll receive * orientation change events based on how the device is physically held, * but the UI will not rotate if orientation lock is enabled. * * Supported on iOS (Core Motion) and Android (Accelerometer). * * @default false * @since 1.0.0 */ bypassOrientationLock?: boolean;}StartOrientationTrackingOptions
스크린 오리엔테이션 추적 옵션 섹션운동 센서를 사용하여 오리엔테이션 추적을 시작하는 옵션.
export interface StartOrientationTrackingOptions { /** * Whether to track physical device orientation using motion sensors. * When true, uses device motion sensors to detect the true physical * orientation of the device, even when the device orientation lock is enabled. * * **Important:** This does NOT bypass the UI orientation lock. * This only enables detection of the physical orientation. * * Supported on iOS (Core Motion) and Android (Accelerometer). * * @default false * @since 1.0.0 */ bypassOrientationLock?: boolean;}OrientationLockStatusResult
스크린 오리엔테이션 잠금 상태 결과 섹션__CAPGO_KEEP_0__에서 반환하는 방향이 고정되어 있는지 여부를 확인하는 isOrientationLocked() 메서드의 결과.
export interface OrientationLockStatusResult { /** * Whether the device orientation lock is currently enabled. * * This is determined by comparing the physical device orientation * (from motion sensors) with the UI orientation. If they differ, * orientation lock is enabled. * * Available on iOS (Core Motion) and Android (Accelerometer) when motion tracking is active. * * @since 1.0.0 */ locked: boolean;
/** * The physical orientation of the device from motion sensors. * Available when motion tracking is active (iOS and Android). * * @since 1.0.0 */ physicalOrientation?: OrientationType;
/** * The current UI orientation reported by the system. * * @since 1.0.0 */ uiOrientation: OrientationType;}OrientationType
‘OrientationType’ 제목의 섹션기기 방향 상태를 설명하는 방향 유형.
export type OrientationType = 'portrait-primary' | 'portrait-secondary' | 'landscape-primary' | 'landscape-secondary';OrientationLockType
‘OrientationLockType’ 제목의 섹션기기 방향을 고정하기 위해 사용할 수 있는 방향 고정 유형.
export type OrientationLockType = | 'any' | 'natural' | 'landscape' | 'portrait' | 'portrait-primary' | 'portrait-secondary' | 'landscape-primary' | 'landscape-secondary';실질적인 출처
‘Source Of Truth’ 제목의 섹션이 페이지는 플러그인의 src/definitions.tsAPI의 upstream에서 변경되면 다시 싱크를 실행하세요.
Getting Started에서 계속 진행하세요
Getting Started에서 계속 진행하는 섹션Capacitor를 사용 중이라면 Getting Started native 미디어 및 인터페이스 동작을 계획하려면 Using @capgo/capacitor-screen-orientation Using @capgo/capacitor-screen-orientation의 native 기능과 연결하세요 Using @capgo/capacitor-live-activities Using @capgo/capacitor-live-activities의 native 기능과 연결하세요 @capgo/capacitor-live-activities @capgo/capacitor-live-activities의 구현 세부 정보 Using @capgo/capacitor-video-player Capgo의 원시 기능을 위해 @capgo/capacitor-video-player를 사용하고, @capgo/capacitor-video-player Capgo의 구현 세부 정보를 위해 @capgo/capacitor-video-player를 사용합니다.