Getting Started
このプラグインのインストール手順とマークダウンガイドを含むセットアップのコピー用テキストをコピーします。
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-alarm`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/alarm/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
Install
「インストール」のセクションCapgoのAI-Assistedセットアップを使用してプラグインをインストールできます。AIツールにCapgoスキルを追加するには、以下のコマンドを実行してください。
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins次に、以下のコマンドを使用してください。
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-alarm` plugin in my project.Manual Setupを使用する場合は、以下のコマンドを実行してください。プラットフォーム固有の指示は下記を参照してください。
bun add @capgo/capacitor-alarmbunx cap syncImport
「Import」セクションimport { CapgoAlarm } from '@capgo/capacitor-alarm';APIの概要
「APIの概要」セクションcreateAlarm
「createAlarm」セクションプラットフォームの時計アプリを使用してネイティブOSのアラームを作成します。 Androidの場合、このアラームはアラームクロックのインテントを使用します。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
セクション「openAlarms」クリップボードにコピー
import { CapgoAlarm } from '@capgo/capacitor-alarm';
const result = await CapgoAlarm.openAlarms();if (result.success) { console.log('Alarms UI opened');}getOSInfo
クリップボードにコピーセクション「requestPermissions」
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
クリップボードにコピーセクション「checkPermissions」
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
pagePathiOSおよびAndroidのネイティブアラームへのアクセスをトリガーせずに現在の許可状態を確認します。 iOSではAlarmKitの準備状況を、Androidでは機能詳細を報告します。
import { CapgoAlarm } from '@capgo/capacitor-alarm';
const status = await CapgoAlarm.checkPermissions();console.log('AlarmKit allowed?', status.details?.alarmKit);getAlarms
getAlarmsこのアプリによって設定されたアラームの一覧を取得します。 iOS 26+では、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}`);});NativeAlarmCreateOptions
ネイティブOSアラームの作成に使用するプラットフォーム時計アプリのオプションです。クリップボードにコピー
export interface NativeAlarmCreateOptions { /** Hour of day in 24h format (0-23) */ hour: number; /** Minute of hour (0-59) */ minute: number; /** Optional label for the alarm */ label?: string; /** Android only: attempt to skip UI if possible */ skipUi?: boolean; /** Android only: set alarm to vibrate */ vibrate?: boolean;}NativeActionResult
ネイティブアクションの結果です。Type Reference
export interface NativeActionResult { /** Whether the action was successful */ success: boolean; /** Optional message with additional information */ message?: string;}OSInfo
OSInfoのセクション現在のOSと機能に関する情報を返します。
export interface OSInfo { /** Platform identifier: 'ios' | 'android' | 'web' */ platform: string; /** OS version string */ version: string; /** Whether the platform exposes a native alarm app integration */ supportsNativeAlarms: boolean; /** Whether scheduling local notifications is supported */ supportsScheduledNotifications: boolean; /** Android only: whether exact alarms are allowed */ canScheduleExactAlarms?: boolean;}PermissionResult
PermissionResultのセクションパーミッションの要求の結果
export interface PermissionResult { /** Overall grant for requested scope */ granted: boolean; /** Optional details by permission key */ details?: Record<string, boolean>; /** Optional human readable diagnostic */ message?: string;}AlarmInfo
AlarmInfoのセクション予定されたアラームに関する情報
export interface AlarmInfo { /** Unique identifier for the alarm */ id: string; /** Hour of day in 24h format (0-23) */ hour: number; /** Minute of hour (0-59) */ minute: number; /** Optional label for the alarm */ label?: string; /** Whether the alarm is enabled */ enabled?: boolean;}真実の源
真実の源のセクションこのページはプラグインから生成されます。 src/definitions.ts.再度、上流のpublic APIが変更されたときにsyncを実行してください。
Getting Startedから続けてください。
セクションのタイトルは「Getting Startedから続けてください。」あなたが使用している場合 Getting Started ダッシュボードとAPIのオペレーションを計画するために使用している場合、APIを native capabilityのための@capgo/capacitor-alarmを使用します。 native capabilityのための@capgo/capacitor-alarmの使用 APIの概要 APIの実装詳細 導入 実装の詳細については、Introductionを参照してください。 API キー 実装の詳細については、API キー、そして デバイス 実装の詳細については、デバイスを参照してください。