diff --git a/app/src/main/kotlin/com/simplemobiletools/clock/services/TimerService.kt b/app/src/main/kotlin/com/simplemobiletools/clock/services/TimerService.kt index efce8159..f1716056 100644 --- a/app/src/main/kotlin/com/simplemobiletools/clock/services/TimerService.kt +++ b/app/src/main/kotlin/com/simplemobiletools/clock/services/TimerService.kt @@ -9,8 +9,8 @@ import android.content.Context import android.content.Intent import android.os.Build import android.os.IBinder -import androidx.annotation.RequiresApi import androidx.core.app.NotificationCompat +import androidx.core.content.ContextCompat import com.simplemobiletools.clock.R import com.simplemobiletools.clock.extensions.getFormattedDuration import com.simplemobiletools.clock.extensions.getOpenTimerTabIntent @@ -118,13 +118,8 @@ class TimerService : Service() { } } -@RequiresApi(Build.VERSION_CODES.O) fun startTimerService(context: Context) { - if (isOreoPlus()) { - context.startForegroundService(Intent(context, TimerService::class.java)) - } else { - context.startService(Intent(context, TimerService::class.java)) - } + ContextCompat.startForegroundService(context, Intent(context, TimerService::class.java)) } object TimerStopService