コンテンツにジャンプ

Getting Started

GitHub

Capgoの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.

If you prefer Manual Setup, install the plugin by running the following commands and follow the platform-specific instructions below:

端末画面
bun add @capgo/capacitor-alarm
bunx cap sync
import { CapgoAlarm } from '@capgo/capacitor-alarm';

「API Overview」セクション

Section titled “API Overview”

「openAlarms」セクション

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);

プラットフォームのネイティブのアラームリストUIを開きます。

import { CapgoAlarm } from '@capgo/capacitor-alarm';
const result = await CapgoAlarm.openAlarms();
if (result.success) {
console.log('Alarms UI opened');
}

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);
}

アラームの使用に必要な権限をリクエストします。 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');
}

ネイティブアラームへのアクセス権限の現在の状態を確認します。UIをトリガーせずに。 iOSの場合、アラームキットの準備状況を報告します。Androidの場合、機能詳細を報告します。

import { CapgoAlarm } from '@capgo/capacitor-alarm';
const status = await CapgoAlarm.checkPermissions();
console.log('AlarmKit allowed?', status.details?.alarmKit);

このアプリで予定されているアラームの一覧を取得します。 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}`);
});

タイプ リファレンス

タイプ リファレンス

クリップボードにコピー

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;
}

OS の情報と機能

export interface NativeActionResult {
/** Whether the action was successful */
success: boolean;
/** Optional message with additional information */
message?: string;
}

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;
}

許可の要求の結果です。

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;
}

予定されているアラームに関する情報です。

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 がアップストリームで変更された場合に再度同期を実行してください。

Getting Started から続けてください

「Getting Started」から続けてください

あなたは「を使用しています 「Getting Started」 ダッシュボードとAPIの作業を計画するには、を接続してください native capabilityのために@capgo/capacitor-alarmを使用 native capabilityのために@capgo/capacitor-alarmを使用する場合の実装詳細 APIの概要 実装詳細のためにAPIの概要を参照 導入 実装詳細のために導入を参照 APIのキー 実装詳細のためにAPIのキーを参照 デバイス デバイスの実装詳細について