컨텐츠로 건너뛰기

Getting Started

설치

설치란
터미널 창
bun add @capgo/capacitor-alarm
bunx cap sync

Import

설치란
import { CapgoAlarm } from '@capgo/capacitor-alarm';

createAlarm

createAlarm

__CAPGO_KEEP_0__을 사용하여 플랫폼 클록 앱을 사용하여 네이티브 OS 알람을 생성합니다. 안드로이드에서는 알람 클록 인텐트를 사용하고, iOS에서는 알람 키트를 사용합니다 (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);

__CAPGO_KEEP_0__의 네이티브 알람 목록 UI를 열 수 있습니다. (사용 가능한 경우).

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

__CAPGO_KEEP_0__에 대한 정보를 가져옵니다. (OS 및 기능).

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);
}

requestPermissions

__CAPGO_KEEP_0__ 섹션

__CAPGO_KEEP_0__을 사용하여 알람에 필요한 권한을 요청합니다. 안드로이드에서는 정확한 알람을 위해 설정으로 라우팅할 수 있습니다.

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');
}

checkPermissions

__CAPGO_KEEP_0__ 섹션

__CAPGO_KEEP_0__을 사용하여 네이티브 알람 접근 권한의 현재 상태를 확인합니다. UI를 트리거하지 않습니다. iOS에서는 알람 킷의 준비 상태를, 안드로이드에서는 기능 상세 정보를 보고합니다.

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

이 앱에 의해 예약된 알람 목록을 가져옵니다. 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}`);
});

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

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;
}

자연 액션의 결과입니다.

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

현재 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;
}

일정 알람에 대한 정보입니다.

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;
}

진실의 근원

진실의 근원 섹션

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

Getting Started에서 계속 진행하세요

“시작부터 계속 가기” 섹션

__CAPGO_KEEP_0__을 사용 중이라면 시작하기 API 대시보드와 API 연산을 계획하려면 API을 capgo/capacitor-alarm을 사용하여 capgo/capacitor-alarm의 원시 기능을 사용하는 경우 @capgo/capacitor-alarm API 개요 API 개요의 구현 세부 정보 소개 소개의 구현 세부 정보 API 키 API 키의 구현 세부 정보 __CAPGO_KEEP_0__ __CAPGO_KEEP_1__