始め方
このプラグインのインストールステップとフルマークダウンガイドまでのセットアップコマンドをコピーしてください。
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.
インストール
「インストール」のセクションAI-Assisted Setupを使用してプラグインをインストールできます。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 syncインポート
「インポート」セクションimport { CapgoAlarm } from '@capgo/capacitor-alarm';API オーバービュー
「API オーバービュー」セクションcreateAlarm
「createAlarm」セクションプラットフォームの時計アプリを使用して、ネイティブOSのアラームを作成します。 Androidでは、Alarm Clock インテントを使用します。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」セクションプラットフォームのネイティブアラームリストUIを開きます。利用可能な場合。
import { CapgoAlarm } from '@capgo/capacitor-alarm';
const result = await CapgoAlarm.openAlarms();if (result.success) { console.log('Alarms UI opened');}getOSInfo
「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
セクション「requestPermissions」このプラットフォームでアラームの使用に必要な権限を要求します。 Androidの場合、正確なアラームの設定にルーティングする場合があります。
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
セクション「checkPermissions」このアプリがアクセスできるnativeアラームの現在の許可状態を確認します。 UIをトリガーせずにiOSのAlarmKitの準備状況、Androidの機能詳細を報告します。
import { CapgoAlarm } from '@capgo/capacitor-alarm';
const status = await CapgoAlarm.checkPermissions();console.log('AlarmKit allowed?', status.details?.alarmKit);getAlarms
セクション「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.
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
ネイティブアクションの結果クリップボードにコピー
export interface NativeActionResult { /** Whether the action was successful */ success: boolean; /** Optional message with additional information */ message?: string;}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
許可の要求の結果Copy to clipboard
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上流で変更されたパブリック API に対して再度同期を実行してください。
「はじめから始める」の続き
「はじめから始める」のセクションCapacitor を使用している場合 はじめから始める ダッシュボードとAPIの運用計画を行うには、 Using @capgo/capacitor-alarm Using @capgo/capacitor-alarm APIの概要 APIの実装詳細 導入 __CAPGO_KEEP_0__のキー APIの実装詳細 for the implementation detail in API Keys, and __CAPGO_KEEP_0__の実装詳細 ページを編集