알람 플러그인 @capgo/capacitor 사용
Capacitor 알람 플러그인: 네이티브 OS 알람 관리 인터페이스
설치
bun add @capgo/capacitor-alarm
bunx cap sync
이 플러그인이 제공하는 것
createAlarm- 네이티브 OS 알람을 생성하여 플랫폼 시계 앱을 사용합니다. 안드로이드에서는 알람 시계 인텐트를 사용하고, iOS에서는 알람 킷이 사용 가능할 때 (iOS 16 이상) 알람 킷을 사용합니다.openAlarms- 플랫폼의 네이티브 알람 목록 UI를 열 수 있습니다. (사용 가능할 때)getOSInfo- OS 정보 및 기능에 대한 정보를 가져옵니다.requestPermissions- 알람 사용을 위한 관련 권한을 요청합니다. 안드로이드에서는 정확한 알람을 위해 설정으로 라우팅할 수 있습니다.
사용 예
createAlarm
네이티브 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);
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');
}
전체 참조
- GitHub: github.com/Cap-go/capacitor-alarm
- 문서: /docs/plugins/alarm/
Using @capgo/capacitor-alarm에서 계속 진행하세요.
이러한 알람을 사용 중이라면 Using @capgo/capacitor-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 플러그인 추가 또는 업데이트 구현 세부 사항에 대해 푸터