메인 콘텐츠로 건너뛰기
플러그인으로 돌아가기
@capgo/capacitor-알람
튜토리얼
@capgo/capacitor-알람

알람

앱이 닫혀도 native 알람과 알림을 스케줄링합니다.

설명서

Alarm에 대한 튜토리얼

장치에서 테스트

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

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

@capgo/capacitor-알람 사용

Capacitor 알람 플러그인: 네이티브 OS 알람 관리 인터페이스

설치

bun add @capgo/capacitor-alarm
bunx cap sync

이 플러그인이 제공하는 것

  • createAlarm - 네이티브 OS 알람을 생성하여 플랫폼 시계 앱을 사용합니다. 안드로이드에서는 알람 시계 인텐트를 사용하고, iOS에서는 AlarmKit을 사용할 수 있습니다 (iOS 16+).
  • openAlarms - 플랫폼의 네이티브 알람 목록 UI를 열 수 있습니다, 만약 사용할 수 있다.
  • getOSInfo - OS와 기능에 대한 정보를 가져옵니다.
  • requestPermissions - 알람 사용을 위해 플랫폼에 필요한 권한을 요청합니다. 안드로이드에서는 정확한 알람을 위해 설정으로 라우팅할 수 있습니다.

예제 사용

createAlarm

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

플랫폼의 네이티브 알람 목록 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');
}

전체 참조

Using @capgo/capacitor-alarm

Capacitor 알람 플러그인을 사용 중이라면 Using @capgo/capacitor-alarm @__CAPGO_KEEP_0__/__CAPGO_KEEP_1__-alarm @capgo/capacitor-alarm capgo/capacitor 알람 구현 세부 사항에 대해 시작하기 __CAPGO_KEEP_0__ 플러그인 디렉토리 구현 세부 사항에 대해 Capgo 플러그인 디렉토리에서 제품 워크플로에 대해 Capgo 플러그인들 - __CAPGO_KEEP_1__ Capacitor 플러그인들 - Capgo 구현 세부 사항에 대해, 그리고 for the implementation detail in Capacitor Plugins by Capgo, and 플러그인 추가 또는 업데이트 구현 세부 사항에 대해 푸터