ionic-team / ionic-team/capacitor-local-notifications

feat: Add Android chronometer support to local notifications plugin

Open
#7 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Kotlin
Stars
0
Forks
0
Avg merge
11h 50m
Merged PRs (30d)
2

Description

## Feature Request

### Plugin

- @capacitor/local-notifications

### Description
Sometimes it is important for time related tasks to show a timer inside the notification. Android supports such functionality by calling the [`setUsesChronometer`](https://developer.android.com/reference/android/app/Notification.Builder#setUsesChronometer(boolean)) function on the [`Notification.Builder`](https://developer.android.com/reference/android/app/Notification.Builder) class. Setting this parameter to `true` will add a small timer with the format `"HH:mm"` that is counting the duration the notification is active.

The [Cordova Plugin / Local Notification](https://github.com/katzer/cordova-plugin-local-notifications) supports this as [`androidUsesChronometer` and `androidShowWhen`](https://github.com/katzer/cordova-plugin-local-notifications?tab=readme-ov-file#android-properties) properties. Adding this feature would make migration to the capacitor plugin even more straight forward.

### Platform(s)

- Android

### Preferred Solution

Add a parameter called `usesChronometer` to the [`LocalNotificationSchema`](https://capacitorjs.com/docs/apis/local-notifications#localnotificationschema) of the [@capacitor/local-notifications Plugin](https://capacitorjs.com/docs/apis/local-notifications). Here is an example, of how this configuration might look like:

```typescript
LocalNotifications.schedule({
notifications: [
{
id: 283912,
title: 'Test Notification',
usesChronometer: true
}
]
});
```

### Alternatives
__No alternatives that come in mind.__

### Additional Context

I need this feature for one of my apps. It is important for the user to see how long the notification is already active.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.