https://github.com/cap-go/capacitor-alarm
Plugin to set and open the native alarms for Capacitor apps
https://github.com/cap-go/capacitor-alarm
capacitor ionic
Last synced: 9 months ago
JSON representation
Plugin to set and open the native alarms for Capacitor apps
- Host: GitHub
- URL: https://github.com/cap-go/capacitor-alarm
- Owner: Cap-go
- Created: 2025-09-15T13:34:31.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2025-09-15T18:05:09.000Z (9 months ago)
- Last Synced: 2025-09-15T19:27:33.029Z (9 months ago)
- Topics: capacitor, ionic
- Language: Swift
- Homepage: https://capgo.app
- Size: 355 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
README
Manage native alarm Capacitor plugin
## Install
```bash
npm install @capgo/capacitor-alarm
npx cap sync
```
## Requirements
- iOS: iOS 26+ only. This plugin relies on `AlarmKit` APIs and will report unsupported on earlier versions or when the framework is unavailable.
- Android: Uses `AlarmClock` intents; behavior depends on the default Clock app and OEM policies.
Note: This plugin only exposes native alarm actions (create/open). It does not implement any custom in-app alarm scheduling/CRUD.
## API
* [`createAlarm(...)`](#createalarm)
* [`openAlarms()`](#openalarms)
* [`getOSInfo()`](#getosinfo)
* [`requestPermissions(...)`](#requestpermissions)
* [Interfaces](#interfaces)
* [Type Aliases](#type-aliases)
### createAlarm(...)
```typescript
createAlarm(options: NativeAlarmCreateOptions) => Promise
```
Create a native OS alarm using the platform clock app.
On Android this uses the Alarm Clock intent; on iOS this use AlarmKit if available (iOS 26+).
| Param | Type |
| ------------- | ----------------------------------------------------------------------------- |
| **`options`** | NativeAlarmCreateOptions |
**Returns:** Promise<NativeActionResult>
--------------------
### openAlarms()
```typescript
openAlarms() => Promise
```
Open the platform's native alarm list UI, if available.
**Returns:** Promise<NativeActionResult>
--------------------
### getOSInfo()
```typescript
getOSInfo() => Promise
```
Get information about the OS and capabilities.
**Returns:** Promise<OSInfo>
--------------------
### requestPermissions(...)
```typescript
requestPermissions(options?: { exactAlarm?: boolean | undefined; } | undefined) => Promise
```
Request relevant permissions for alarm usage on the platform.
On Android, may route to settings for exact alarms.
| Param | Type |
| ------------- | -------------------------------------- |
| **`options`** | { exactAlarm?: boolean; } |
**Returns:** Promise<PermissionResult>
--------------------
### Interfaces
#### NativeActionResult
| Prop | Type |
| ------------- | -------------------- |
| **`success`** | boolean |
| **`message`** | string |
#### NativeAlarmCreateOptions
Options for creating a native OS alarm via the platform clock app.
| Prop | Type | Description |
| ------------- | -------------------- | -------------------------------------------- |
| **`hour`** | number | Hour of day in 24h format (0-23) |
| **`minute`** | number | Minute of hour (0-59) |
| **`label`** | string | Optional label for the alarm |
| **`skipUi`** | boolean | Android only: attempt to skip UI if possible |
| **`vibrate`** | boolean | Android only: set alarm to vibrate |
#### OSInfo
Returned info about current OS and capabilities.
| Prop | Type | Description |
| ------------------------------------ | -------------------- | ----------------------------------------------------------- |
| **`platform`** | string | 'ios' \| 'android' \| 'web' |
| **`version`** | string | OS version string |
| **`supportsNativeAlarms`** | boolean | Whether the platform exposes a native alarm app integration |
| **`supportsScheduledNotifications`** | boolean | Whether scheduling local notifications is supported |
| **`canScheduleExactAlarms`** | boolean | Android only: whether exact alarms are allowed |
#### PermissionResult
Result of a permissions request.
| Prop | Type | Description |
| ------------- | ---------------------------------------------------------------- | ---------------------------------- |
| **`granted`** | boolean | Overall grant for requested scope |
| **`details`** | Record<string, boolean> | Optional details by permission key |
### Type Aliases
#### Record
Construct a type with a set of properties K of type T
{
[P in K]: T;
}
