Remove startForeground from AlarmService

Starting a foreground service from the background
causes errors in android 12+
This commit is contained in:
Brandon Presley 2024-02-16 13:13:52 +13:00
parent 6e604d7618
commit 1e7c994209
1 changed files with 2 additions and 3 deletions

View File

@ -114,11 +114,10 @@ class AlarmService : Service(), OnPreparedListener {
return notification
}
@RequiresApi(Build.VERSION_CODES.O)
@SuppressLint("Recycle")
@RequiresApi(api = Build.VERSION_CODES.O)
override fun onStartCommand(intent: Intent, flags: Int, startId: Int): Int {
val notification = doNotify()
startForeground(NOTIFICATION_ID_DONE, notification)
doNotify()
val settings = getSettings()
playSound(settings)
if (!settings.vibrate) return START_STICKY