mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 06:10:31 +05:30
Merge pull request #2660 from Isira-Seneviratne/ServiceCompat
Use ServiceCompat.
This commit is contained in:
commit
5f8e0e70d7
@ -10,6 +10,7 @@ import android.os.Handler
|
|||||||
import android.os.IBinder
|
import android.os.IBinder
|
||||||
import android.os.Looper
|
import android.os.Looper
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
|
import androidx.core.app.ServiceCompat
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper
|
import com.fasterxml.jackson.databind.ObjectMapper
|
||||||
import com.github.libretube.R
|
import com.github.libretube.R
|
||||||
import com.github.libretube.api.RetrofitInstance
|
import com.github.libretube.api.RetrofitInstance
|
||||||
@ -373,12 +374,7 @@ class BackgroundMode : Service() {
|
|||||||
|
|
||||||
// called when the user pressed stop in the notification
|
// called when the user pressed stop in the notification
|
||||||
// stop the service from being in the foreground and remove the notification
|
// stop the service from being in the foreground and remove the notification
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
ServiceCompat.stopForeground(this, ServiceCompat.STOP_FOREGROUND_REMOVE)
|
||||||
stopForeground(STOP_FOREGROUND_REMOVE)
|
|
||||||
} else {
|
|
||||||
@Suppress("DEPRECATION")
|
|
||||||
stopForeground(true)
|
|
||||||
}
|
|
||||||
// destroy the service
|
// destroy the service
|
||||||
stopSelf()
|
stopSelf()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user