Skip to content

Commit 6f0bae1

Browse files
committed
fix(app): replace startForegroundService with startService in alarm service controller
possibly causing 'RemoteServiceException: Context.startForegroundService() did not then call Service.startForeground()' since dismiss and snooze actions actually stop the service, instead of starting it
1 parent ff99b4e commit 6f0bae1

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

app/src/main/java/com/github/ashutoshgngwr/noice/di/AlarmRingerModule.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package com.github.ashutoshgngwr.noice.di
22

33
import android.content.Context
44
import android.content.Intent
5-
import androidx.core.content.ContextCompat
65
import com.github.ashutoshgngwr.noice.activity.AlarmRingerActivity
76
import com.github.ashutoshgngwr.noice.service.AlarmRingerService
87
import dagger.Module
@@ -40,12 +39,12 @@ object AlarmRingerModule {
4039
return object : AlarmRingerActivity.ServiceController {
4140
override fun dismiss(alarmId: Int) {
4241
AlarmRingerService.buildDismissIntent(context, alarmId)
43-
.also { ContextCompat.startForegroundService(context, it) }
42+
.also { context.startService(it) }
4443
}
4544

4645
override fun snooze(alarmId: Int) {
4746
AlarmRingerService.buildSnoozeIntent(context, alarmId)
48-
.also { ContextCompat.startForegroundService(context, it) }
47+
.also { context.startService(it) }
4948
}
5049
}
5150
}

0 commit comments

Comments
 (0)