본문 바로가기
@capgo/capacitor-alarm Device API 오픈 소스

알람 Capacitor 플러그인

앱이 종료된 상태에서도 네이티브 알람 및 알림 예약 가능

설치

bun add @capgo/capacitor-alarm bunx cap sync
npm, pnpm 또는 yarn
  • npm install @capgo/capacitor-alarm
  • pnpm add @capgo/capacitor-alarm
  • yarn add @capgo/capacitor-alarm

가이드

Capacitor에서 Alarm 사용법

@capgo/capacitor-alarm 사용하기

네이티브 OS 알람 관리를 위한 Capacitor Alarm Plugin 인터페이스

설치

bun add @capgo/capacitor-alarm
bunx cap sync

bunx cap sync 플러그인의 네이티브 code를 네이티브 프로젝트에 복사합니다. 플러그인을 업그레이드할 때마다 다시 실행하세요.

가져오기

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

API 한눈에 보기

메서드 설명
createAlarm 플랫폼 시계 앱을 사용하여 네이티브 OS 알람을 생성합니다. Android에서는 Alarm Clock intent를 사용하며, iOS에서는 사용 가능한 경우(iOS 16+) AlarmKit을 사용합니다.
openAlarms 사용 가능한 경우 플랫폼의 네이티브 알람 목록 UI를 엽니다.
getOSInfo OS 및 기능에 대한 정보를 가져옵니다.
requestPermissions 플랫폼에서 알람 사용에 필요한 권한을 요청합니다. Android의 경우 정확한 알람(exact alarms) 설정을 위해 설정 화면으로 이동할 수 있습니다.
checkPermissions UI를 띄우지 않고 네이티브 알람 접근에 대한 현재 권한 상태를 확인합니다. iOS에서는 AlarmKit 준비 상태를, Android에서는 기능 상세 정보를 보고합니다.
getAlarms 이 앱이 예약한 알람 목록을 가져옵니다. iOS 26+에서는 AlarmKit의 알람을 반환합니다. Android는 시스템에서 알람 조회를 위한 API를 제공하지 않으므로 지원되지 않습니다.
cancelAlarm ID를 사용하여 예약된 알람을 취소합니다. iOS 26+에서는 AlarmKit에서 알람을 제거합니다. Android/web에서는 지원되지 않습니다.

예시

createAlarm()

플랫폼 시계 앱을 사용하여 네이티브 OS 알람을 생성합니다. Android에서는 Alarm Clock intent를 사용하며, iOS에서는 사용 가능한 경우(iOS 16+) AlarmKit을 사용합니다.

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()

사용 가능한 경우 플랫폼의 네이티브 알람 목록 UI를 엽니다.

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

const result = await CapgoAlarm.openAlarms();
if (result.success) {
  console.log('Alarms UI opened');
}

getOSInfo()

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()

플랫폼에서 알람 사용에 필요한 권한을 요청합니다. Android의 경우 정확한 알람 설정을 위해 설정 화면으로 이동할 수 있습니다.

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()

UI를 띄우지 않고 네이티브 알람 접근에 대한 현재 권한 상태를 확인합니다. iOS에서는 AlarmKit 준비 상태를, Android에서는 기능 상세 정보를 보고합니다.

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

const status = await CapgoAlarm.checkPermissions();
console.log('AlarmKit allowed?', status.details?.alarmKit);

getAlarms()

이 앱이 예약한 알람 목록을 가져옵니다. iOS 16+에서는 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}`);
});

위 표에는 7가지 핵심 메서드가 나열되어 있습니다. Listener 및 버전 헬퍼, 각 메서드의 전체 계약(contract)은 다음 문서에 설명되어 있습니다. GitHub 리포지토리.

전체 레퍼런스

@capgo/capacitor-alarm 사용법 계속 보기

사용 중이라면 @capgo/capacitor-alarm 사용하기 네이티브 플러그인 작업을 계획하려면, 이를 다음 항목과 연결하세요: @capgo/capacitor-alarm @capgo/capacitor-alarm의 구현 세부 사항은 시작하기 Getting Started의 구현 상세 내용은 Capgo 플러그인 디렉토리 Capgo Plugin Directory의 제품 워크플로우에 맞춰, Capgo의 Capacitor 플러그인 Capgo의 Capacitor Plugins 구현 세부 사항 및 플러그인 추가 또는 업데이트 플러그인 추가 또는 업데이트의 구현 세부 사항은.

자주 묻는 질문

Alarm plugin FAQ

Capacitor 앱에 Alarm plugin을 어떻게 설치하나요?

"bun add @capgo/capacitor-alarm" (또는 "npm install @capgo/capacitor-alarm")를 실행한 다음, "bunx cap sync"를 실행하여 iOS 및 Android 프로젝트에 네이티브 code가 반영되도록 하세요. 그 후 앱의 code에서 "@capgo/capacitor-alarm"를 통해 import 하세요.

@capgo/capacitor-alarm가 React, Vue, Angular와 호환되나요?

네. Alarm은 Capacitor 패키지이므로 Ionic, React, Vue, Angular, Svelte 및 일반 JavaScript를 포함하여 Capacitor에서 실행되는 모든 웹 프레임워크와 호환됩니다.

@capgo/capacitor-alarm은 어떤 Capacitor 버전을 지원하나요?

Capgo 플러그인은 Capacitor의 메이저 버전을 따릅니다. 사용 중인 Capacitor 메이저 버전과 일치하는 플러그인 메이저 버전을 사용하세요 (예: Capacitor 8에는 플러그인 v8). 유지 관리되는 버전은 GitHub README의 호환성 표에서 확인할 수 있습니다.

@capgo/capacitor-alarm는 무료 오픈 소스인가요?

네. code 소스 코드는 GitHub의 https://github.com/Cap-go/capacitor-alarm/ 에 공개되어 있으며, npm에서 무료로 설치할 수 있습니다. 버그 리포트와 pull request는 언제나 환영합니다.

App Store 심사 없이 Alarm을 사용하는 code를 업데이트할 수 있나요?

플러그인을 설치하거나 업그레이드하면 네이티브 code가 변경되므로 새로운 스토어 빌드가 필요합니다. 그 이후에는 플러그인을 호출하는 JavaScript, HTML, CSS 변경 사항을 Capgo live updates로 즉시 배포할 수 있습니다.

앱 심사 대기 없이 Alarm 변경 사항 배포

스토어 빌드에 플러그인이 포함되면, Capgo live updates로 JavaScript, HTML, CSS 변경 사항을 몇 분 만에 사용자에게 푸시할 수 있습니다.

Capgo로 시작하기