가이드
알람 튜토리얼
알람 플러그인 @capgo/capacitor-alarm 사용
Capacitor 알람 플러그인: 네이티브 OS 알람 관리
설치
bun add @capgo/capacitor-alarm
bunx cap sync
What This Plugin Exposes
createAlarm- native OS 알람을 생성하기 위해 플랫폼 클록 앱을 사용합니다. 안드로이드에서는 알람 클록 인텐트를 사용하고, iOS에서는 AlarmKit이 사용 가능할 경우 (iOS 16+) 사용합니다.openAlarms- 플랫폼의 native 알람 목록 UI를 열 수 있습니다. 사용 가능할 경우.getOSInfo- OS 정보와 기능에 대한 정보를 가져옵니다.requestPermissions- 알람 사용을 위해 플랫폼의 관련 권한을 요청합니다. 안드로이드에서는 정확한 알람을 위해 설정으로 라우팅할 수 있습니다.
Example Usage
createAlarm
native 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
플랫폼의 native 알람 목록 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');
}
Full Reference
- GitHub: https://github.com/Cap-go/capacitor-alarm/
- 문서: /docs/plugins/alarm/
capgo에서 capacitor-alarm을 계속 사용하세요.
__CAPGO_KEEP_0__을 사용 중이라면 capgo을 사용하여 capacitor-alarm을 사용하고 있습니다. __CAPGO_KEEP_0__을 사용하여 __CAPGO_KEEP_1__-alarm과 연결하여 capgo을 사용하여 capacitor-alarm의 구현 세부 사항을 참조하세요. for the implementation detail in @capgo/capacitor-alarm, __CAPGO_KEEP_1__-alarm의 구현 세부 사항을 참조하세요. __CAPGO_KEEP_0__ 플러그인 디렉토리 Capgo 플러그인 디렉토리의 제품 워크플로우를 참조하세요. for the product workflow in Capgo Plugin Directory, Capacitor 플러그인들에 의해 Capgo Capacitor 플러그인들에 의해 Capgo의 구현 세부 사항에 대해 플러그인 추가 또는 업데이트 플러그인 추가 또는 업데이트의 구현 세부 사항에 대해