capacitor-timer-notification
A Capacitor plugin to create a timer notification that displays a countdown timer in the notification bar.
Usage
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>
Param | Type |
---|
options | { duration: number; } |
updateNotification(...)
updateNotification(options: { duration: number; statusText: string; }) => Promise<void>
Param | Type |
---|
options | { duration: number; statusText: string; } |
stopTimer()
stopTimer() => Promise<void>
getButtonClicked()
getButtonClicked() => Promise<{ observe(callback: (action: string) => void): void; }>
Returns: Promise<{ observe(callback: (action: string) => void): void; }>