0.2.4 • Published 8 months ago

capacitor-timer-notification v0.2.4

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

capacitor-timer-notification

A Capacitor plugin to create a timer notification that displays a countdown timer in the notification bar.

Usage

Please provide an audio file in the android/app/src/main/res/raw directory of your project. The plugin will use this audio file to play a sound when the timer is up.

Add the following to your android/app/src/main/AndroidManifest.xml file to declare the necessary permissions and service:

<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK" />

<service
  android:name=".TimerService"
  android:enabled="true"
  android:exported="false"
  android:foregroundServiceType="mediaPlayback"/>




## Install

```bash
npm install capacitor-timer-notification
npx cap sync

API

startTimer(...)

startTimer(options: { duration: number; }) => Promise<void>

Starts the timer with the given duration in seconds.

ParamTypeDescription
options{ duration: number; }- Object containing the duration of the timer.

stopTimer()

stopTimer() => Promise<void>

Stops the currently running timer.


pauseTimer()

pauseTimer() => Promise<void>

Pauses the currently running timer.


resumeTimer()

resumeTimer() => Promise<void>

Resumes the paused timer.


addListener('remainingTimeUpdate', ...)

addListener(eventName: 'remainingTimeUpdate', listenerFunc: (data: { remainingTime: number; }) => void) => Promise<PluginListenerHandle>

Listens for updates on the remaining time of the timer.

ParamTypeDescription
eventName'remainingTimeUpdate'- The name of the event, e.g., "remainingTimeUpdate".
listenerFunc(data: { remainingTime: number; }) => void- Callback function that receives the remaining time.

Returns: Promise<PluginListenerHandle>


removeAllListeners(...)

removeAllListeners(eventName: string) => Promise<void>

Removes all listeners for a given event.

ParamTypeDescription
eventNamestring- The name of the event to remove listeners for.

Interfaces

PluginListenerHandle

PropType
remove() => Promise<void>
0.1.95

8 months ago

0.1.9

8 months ago

0.2.1

8 months ago

0.2.0

8 months ago

0.2.3

8 months ago

0.2.2

8 months ago

0.2.4

8 months ago

0.1.0

8 months ago

0.1.2

8 months ago

0.1.1

8 months ago

0.1.8

8 months ago

0.1.7

8 months ago

0.1.4

8 months ago

0.1.3

8 months ago

0.1.6

8 months ago

0.1.5

8 months ago

0.1.75

8 months ago

0.1.65

8 months ago

0.0.36

10 months ago

0.0.35

10 months ago

0.0.34

10 months ago

0.0.33

10 months ago

0.0.32

10 months ago

0.0.31

10 months ago

0.0.30

10 months ago

0.0.29

10 months ago

0.0.28

10 months ago

0.0.27

10 months ago

0.0.26

10 months ago

0.0.25

10 months ago

0.0.24

10 months ago

0.0.23

10 months ago

0.0.22

10 months ago

0.0.21

10 months ago

0.0.20

10 months ago

0.0.19

10 months ago

0.0.18

10 months ago

0.0.17

10 months ago

0.0.16

10 months ago

0.0.15

10 months ago

0.0.14

10 months ago

0.0.13

10 months ago

0.0.12

10 months ago

0.0.11

10 months ago

0.0.10

10 months ago

0.0.9

10 months ago

0.0.8

10 months ago

0.0.7

10 months ago

0.0.6

10 months ago

0.0.5

10 months ago

0.0.4

10 months ago

0.0.3

10 months ago

0.0.2

10 months ago

0.0.1

10 months ago