mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 22:30:30 +05:30
fix background service for lower Android versions
This commit is contained in:
parent
f99ef78699
commit
9aee6bc964
@ -2,6 +2,7 @@ package com.github.libretube.util
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Build
|
||||
import com.github.libretube.services.BackgroundMode
|
||||
|
||||
/**
|
||||
@ -21,6 +22,10 @@ object BackgroundHelper {
|
||||
if (position != null) intent.putExtra("position", position)
|
||||
|
||||
// start the background mode as foreground service
|
||||
context.startForegroundService(intent)
|
||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.O) {
|
||||
context.startForegroundService(intent)
|
||||
} else {
|
||||
context.startService(intent)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user