feat: Implement a foreground service to run the timer

This fixes many issues that were occurring because of the app being killed in the background

Closes: #31
This commit is contained in:
Nishant Mishra
2025-09-14 12:39:27 +05:30
parent bec64cbdda
commit 90fa94e065
6 changed files with 448 additions and 265 deletions

View File

@@ -2,6 +2,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.POST_PROMOTED_NOTIFICATIONS" />
@@ -26,6 +28,13 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service
android:name=".service.TimerService"
android:foregroundServiceType="specialUse">
<property
android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE"
android:value="Required to keep the timer running in the background" />
</service>
</application>
</manifest>