내용으로 건너뛰기

Getting Started

GitHub

AI-Assisted Setup을 사용하여 플러그인을 설치할 수 있습니다. 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-alarm` plugin in my project.

만약 Manual Setup을 선호한다면, 다음 명령어를 실행하고 아래의 플랫폼별 지침을 따르세요:

터미널 창
bun add @capgo/capacitor-alarm
bunx cap sync
import { CapgoAlarm } from '@capgo/capacitor-alarm';

native OS 알람을 플랫폼 클록 앱을 사용하여 생성하세요. Android에서는 알람 클록 인텐트를 사용하고, iOS에서는 AlarmKit을 사용합니다 (iOS 16 이상).

import { CapgoAlarm } from '@capgo/capacitor-alarm';
const result = await CapgoAlarm.createAlarm({
hour: 7,
minute: 30,
label: 'Wake up',
skipUi: false,
vibrate: true
});
console.log('Alarm created:', result.success);

openAlarms

openAlarms

클립보드 복사

import { CapgoAlarm } from '@capgo/capacitor-alarm';
const result = await CapgoAlarm.openAlarms();
if (result.success) {
console.log('Alarms UI opened');
}

클립보드 복사

import { CapgoAlarm } from '@capgo/capacitor-alarm';
const info = await CapgoAlarm.getOSInfo();
console.log('Platform:', info.platform);
console.log('Supports native alarms:', info.supportsNativeAlarms);
if (info.platform === 'android') {
console.log('Can schedule exact alarms:', info.canScheduleExactAlarms);
}

클립보드 복사

import { CapgoAlarm } from '@capgo/capacitor-alarm';
const result = await CapgoAlarm.requestPermissions({ exactAlarm: true });
if (result.granted) {
console.log('Permissions granted');
} else {
console.log('Permissions denied');
}

iOS와 Android에서 native 알람 접근 권한 상태를 확인합니다. iOS에서는 AlarmKit 준비 상태를, Android에서는 기능 상세 정보를 보고합니다.

import { CapgoAlarm } from '@capgo/capacitor-alarm';
const status = await CapgoAlarm.checkPermissions();
console.log('AlarmKit allowed?', status.details?.alarmKit);

getAlarms

getAlarms

이 앱에서 설정한 알람 목록을 가져옵니다. iOS 26 이상에서는 AlarmKit에서 알람을 반환합니다. Android에서는 지원되지 않습니다. 시스템이 알람을 조회하는 API을 제공하지 않기 때문입니다.

import { CapgoAlarm } from '@capgo/capacitor-alarm';
const { alarms } = await CapgoAlarm.getAlarms();
console.log('Scheduled alarms:', alarms);
alarms.forEach(alarm => {
console.log(`Alarm ${alarm.id}: ${alarm.hour}:${alarm.minute} - ${alarm.label}`);
});

타입 참조

타입 참조

클립보드 복사

export interface NativeAlarmCreateOptions {
/** Hour of day in 24h format (0-23) */
hour: number;
/** Minute of hour (0-59) */
minute: number;
/** Optional label for the alarm */
label?: string;
/** Android only: attempt to skip UI if possible */
skipUi?: boolean;
/** Android only: set alarm to vibrate */
vibrate?: boolean;
}

NativeActionResult

native 액션 결과

native OS 알람을 생성하기 위한 플랫폼 클록 앱 옵션입니다.

export interface NativeActionResult {
/** Whether the action was successful */
success: boolean;
/** Optional message with additional information */
message?: string;
}

OSInfo

OSInfo

현재 OS와 기능에 대한 정보를 반환합니다.

export interface OSInfo {
/** Platform identifier: 'ios' | 'android' | 'web' */
platform: string;
/** OS version string */
version: string;
/** Whether the platform exposes a native alarm app integration */
supportsNativeAlarms: boolean;
/** Whether scheduling local notifications is supported */
supportsScheduledNotifications: boolean;
/** Android only: whether exact alarms are allowed */
canScheduleExactAlarms?: boolean;
}

PermissionResult

권한 요청의 결과

복사

export interface PermissionResult {
/** Overall grant for requested scope */
granted: boolean;
/** Optional details by permission key */
details?: Record<string, boolean>;
/** Optional human readable diagnostic */
message?: string;
}

AlarmInfo

복사

실질적인 출처

export interface AlarmInfo {
/** Unique identifier for the alarm */
id: string;
/** Hour of day in 24h format (0-23) */
hour: number;
/** Minute of hour (0-59) */
minute: number;
/** Optional label for the alarm */
label?: string;
/** Whether the alarm is enabled */
enabled?: boolean;
}

Source Of Truth

실질적인 출처

이 페이지는 플러그인의 src/definitions.ts. 업스트림에서 API이 변경되었을 때 다시 싱크를 실행하세요.

Getting Started에서 계속하기

Getting Started에서 계속하기

만약 Getting Started 를 사용하여 대시보드와 API를 계획하고 운영하고 싶다면 Using @capgo/capacitor-alarm Using @capgo/capacitor-alarm Using @API/__CAPGO_KEEP_1__-alarm 에서 사용하는 API __CAPGO_KEEP_0__ Overview implementation detail에 대한 소개에서 API 키 implementation detail에 대한 API 키, 및 장치 implementation detail에 대한 장치에서