메인 콘텐츠로 건너뛰기
@capgo/capacitor-알람 기기 API 오픈 소스

알람 Capacitor 플러그인

앱이 닫혀도 native 알람과通知를 스케줄링하고 관리하세요

설치

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에서 알람 사용하는 방법

장치에서 테스트

Capgo 앱을 다운로드한 후 QR code를 스캔하세요.

알람 플러그인 미리보기 QR code

@capgo/capacitor-알람을 사용합니다.

Capacitor 알람 플러그인은 네이티브 OS 알람 관리를 위한 인터페이스입니다.

설치

bun add @capgo/capacitor-alarm
bunx cap sync

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

수입

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

API의 개요

방법 설명
createAlarm Android 및 iOS 플랫폼의 시계 앱을 사용하여 네이티브 OS 알람을 생성합니다. Android에서는 알람 클록 인텐트를 사용하고 iOS에서는 iOS 16 이상에서 사용 가능한 알람 키트를 사용합니다.
openAlarms OS의 네이티브 알람 목록 UI를 열어보세요. (가능한 경우)
getOSInfo OS 및 기능에 대한 정보를 가져오세요.
requestPermissions 알람 사용을 위한 관련 권한을 요청하세요. Android에서는 정확한 알람을 위해 설정으로 라우팅할 수 있습니다.
checkPermissions 네이티브 알람 접근을 위한 현재 권한 상태를 확인하세요. iOS에서는 알람 키트 준비 상태를, Android에서는 기능 세부 정보를 보고합니다.
getAlarms Get a list of alarms scheduled by this app. On iOS 26+, returns alarms from AlarmKit. On Android, this is not supported as the system does not provide an API to query alarms.
cancelAlarm 알람 ID를 사용하여 예약된 알람을 취소하세요. iOS 26 이상에서는 알람 키트에서 알람을 제거합니다. Android/web에서는 지원되지 않습니다.

예시

createAlarm()

Android 및 iOS 플랫폼의 시계 앱을 사용하여 네이티브 OS 알람을 생성합니다. Android에서는 알람 클록 인텐트를 사용하고 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);

openAlarms()

OS의 네이티브 알람 목록 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()

알람 사용을 위해 플랫폼에서 관련된 권한을 요청하세요. 안드로이드에서는 정확한 알람을 위해 설정으로 라우팅할 수 있습니다.

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

native 알람 접근 권한의 현재 상태를 확인하세요. iOS에서는 알람 킷의 준비 상태를, 안드로이드에서는 기능 상세를 보고합니다.

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

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

getAlarms()

이 앱에서 설정된 알람 목록을 가져오세요. iOS 26 이상에서는 알람 킷에서 알람을 반환합니다. 안드로이드에서는 지원되지 않으며 시스템이 알람을 조회하는 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개의 핵심 메서드가 나열되어 있습니다. 리스너 및 버전 헬퍼, 각 메서드의 전체 계약은 __CAPGO_KEEP_0__ repository에서 문서화되어 있습니다. GitHub.

전체 참조

Using @capgo/capacitor-alarm

Using @__CAPGO_KEEP_0__/__CAPGO_KEEP_1__-alarm @Capacitor-capgo/capacitor-alarm native 플러그인 작업을 계획하기 위해, 그것을 연결하세요. @capgo/capacitor-알람 @capgo/capacitor-알람의 구현 세부 사항 시작하기 시작하기의 구현 세부 사항 Capgo 플러그인 디렉토리 Capgo 플러그인 디렉토리의 제품 워크플로 Capacitor 플러그인들에 의해 Capgo Capacitor 플러그인들에 의해 Capgo의 구현 세부 사항 플러그인 추가 또는 업데이트 플러그인 추가 또는 업데이트의 구현 세부 사항

FAQ

알람 플러그인 FAQ

알람 플러그인을 Capacitor 앱에 설치하는 방법은?

Run "bun add @capgo/capacitor-alarm" (or "npm install @capgo/capacitor-alarm"), then run "bunx cap sync" so the iOS and Android projects pick up the native code. Import it from "@capgo/capacitor-alarm" in your app code.

리액트, 뷰, 앵귤러와 함께 @capgo/capacitor-알람이 작동합니까?

예. @Capacitor는 Capacitor 내에서 작동하는 모든 웹 프레임워크와 함께 작동합니다. 이에는 이온, 리액트, 뷰, 앵귤러, 스벨트 및 평범한 자바스크립트가 포함됩니다.

어떤 @Capacitor 버전이 @capgo/capacitor-알람을 지원합니까?

Capgo plugins follow Capacitor's major version: use the plugin major version that matches your Capacitor major version (for example plugin v8 with Capacitor 8). The compatibility table in the GitHub README lists the maintained versions.

어떻게 하면 @capgo/capacitor-알람을 무료로 사용할 수 있나요?

예. @code의 소스 코드는 https://github.com/Cap-go/capacitor-알람/에서 GitHub에 공개되어 있으며 npm에서 무료로 설치할 수 있습니다. 버그 리포트와 풀 리퀘스트는 환영합니다.

@code/__CAPGO_KEEP_1__-알람을 업데이트할 수 있나요?

플러그인을 설치하거나 업그레이드하면 네이티브 @code이 변경되므로 새로운 스토어 빌드를 필요로 합니다. 그 후에 자바스크립트, HTML 및 CSS 변경 사항이 플러그인을 호출하는 경우 Capgo 라이브 업데이트와 함께 즉시 배포할 수 있습니다.

앱 리뷰 기다리지 않고 Ship Alarm 변경

Capgo

Capgo