시작하기
이 플러그인의 설치 단계와 전체 마크다운 가이드가 포함된 설정 프롬프트를 복사하세요.
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-light-sensor`
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/light-sensor/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-Assisted Setup으로 플러그인을 설치할 수 있습니다. 다음 명령어로 AI 도구에 Capgo 스킬을 추가하세요:
bunx 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-light-sensor` plugin in my project.수동 설정을 선호한다면, 다음 명령어를 실행하여 플러그인을 설치하고 아래의 플랫폼별 지침을 따르세요:
bun add @capgo/capacitor-light-sensorbunx cap sync가져오기
“Import” 섹션import { LightSensor } from '@capgo/capacitor-light-sensor';빠른 시작
“빠른 시작” 섹션import { LightSensor } from '@capgo/capacitor-light-sensor';
const { available } = await LightSensor.isAvailable();예시: start
“예제: 시작하기” 섹션import { LightSensor } from '@capgo/capacitor-light-sensor';
await LightSensor.start({ updateInterval: 500 });예시: 중지
“예시: stop” 섹션import { LightSensor } from '@capgo/capacitor-light-sensor';
await LightSensor.stop();자주 하는 실수
“흔한 실수” 섹션- 권한: 호출
checkPermissions()그다음requestPermissions()필요할 때. - 리스너: 화면이 언마운트될 때 핸들을 제거합니다.
- 신뢰할 수 있는 소스: 신뢰
src/definitions.tsGitHub 레포지토리에서.
API 개요
“API 개요” 섹션isAvailable
“isAvailable” 섹션현재 기기에서 조도 센서를 사용할 수 있는지 확인하세요. 센서를 사용하기 전에 항상 사용 가능 여부를 먼저 확인해야 합니다.
import { LightSensor } from '@capgo/capacitor-light-sensor';
const { available } = await LightSensor.isAvailable();start
“start” 섹션조도 센서 업데이트를 수신합니다.
지정한 간격으로 센서 측정이 시작됩니다.
센서 데이터를 받으려면 addListener 를 사용하세요.
import { LightSensor } from '@capgo/capacitor-light-sensor';
await LightSensor.start({ updateInterval: 500 });stop
“stop” 섹션조도 센서 업데이트 수신을 중단합니다. 센서 작동을 멈추고 배터리를 절약합니다.
import { LightSensor } from '@capgo/capacitor-light-sensor';
await LightSensor.stop();checkPermissions
“checkPermissions” 섹션고속 샘플링 센서의 현재 권한 상태를 확인합니다. Android 12 이상에서는 센서 업데이트 간격이 200ms 미만일 경우 HIGH_SAMPLING_RATE_SENSORS 권한이 필요합니다.
import { LightSensor } from '@capgo/capacitor-light-sensor';
const status = await LightSensor.checkPermissions();requestPermissions
“requestPermissions” 섹션높은 샘플링 속도 센서 사용 권한을 요청합니다. Android 12 이상에서는 HIGH_SAMPLING_RATE_SENSORS 권한을 요청합니다.
import { LightSensor } from '@capgo/capacitor-light-sensor';
const status = await LightSensor.requestPermissions();타입 레퍼런스
“타입 참조” 섹션IsAvailableResult
“IsAvailableResult” 섹션센서 사용 가능 여부를 나타내는 결과값입니다.
export interface IsAvailableResult { /** * Whether the light sensor is available on this device. * Always false on iOS as the light sensor API is not available. * * @since 0.0.1 */ available: boolean;}StartOptions
“StartOptions” 섹션조도 센서 리스너를 시작하기 위한 옵션입니다.
export interface StartOptions { /** * The desired interval between sensor updates in milliseconds. * On Android 12+, there's a minimum interval of 200ms unless the app * has the HIGH_SAMPLING_RATE_SENSORS permission. * * @default 200 * @since 0.0.1 */ updateInterval?: number;}LightSensorCallback
“LightSensorCallback” 섹션조도 센서 업데이트를 위한 콜백 함수입니다.
export type LightSensorCallback = (measurement: LightSensorMeasurement) => void;PermissionStatus
“PermissionStatus” 섹션권한 요청 또는 확인 결과입니다.
export interface PermissionStatus { /** * Whether the high sampling rate sensor permission is granted. * On Android 12+, this permission is required for update intervals below 200ms. * * @since 0.0.1 */ highSamplingRate: 'prompt' | 'prompt-with-rationale' | 'granted' | 'denied';}VersionResult
“VersionResult” 섹션플러그인 버전 정보입니다.
export interface VersionResult { /** * The current version of the plugin. * * @since 0.0.1 */ version: string;}LightSensorMeasurement
“LightSensorMeasurement” 섹션단일 조도 센서 측정값입니다.
export interface LightSensorMeasurement { /** * Ambient light level in lux (lx). * * @since 0.0.1 */ illuminance: number;
/** * Timestamp of the measurement in seconds since epoch. * * @since 0.0.1 */ timestamp: number;}Source of Truth
“Source Of Truth” 섹션이 페이지는 플러그인의 src/definitions.tsupstream에서 public API가 변경되면 sync를 다시 실행하세요.
시작하기 다음 단계
“Getting Started에서 계속하기” 섹션사용 중이라면 시작하기 대시보드 및 API 운영을 계획하려면, 이를 다음과 연결하세요 @capgo/capacitor-light-sensor 사용하기 @capgo/capacitor-light-sensor 사용 시 네이티브 기능을 위해, API 개요 구현 세부 사항은 API 개요에서 소개 구현 세부 사항은 소개에서 API 키 API Keys의 구현 세부 사항은, 기기 Devices의 구현 세부 사항은.