Fix ChannelManager crash on older API levels

This commit is contained in:
Bill Thornton 2020-01-16 10:59:23 -05:00
parent bf79e8c337
commit e5771f4c95
2 changed files with 8 additions and 4 deletions

View File

@ -1,6 +1,8 @@
[*]
end_of_line = lf
insert_final_newline = true
[{*.kts, *.kt}]
charset = utf-8
end_of_line = crlf
insert_final_newline = true
indent_style = tab
tab_width = 4

View File

@ -2,6 +2,7 @@ package org.jellyfin.androidtv.channels
import android.content.Intent
import android.net.Uri
import android.os.Build
import androidx.tvprovider.media.tv.TvContractCompat.WatchNextPrograms
import androidx.tvprovider.media.tv.WatchNextProgram
import kotlinx.coroutines.Dispatchers
@ -33,9 +34,10 @@ class ChannelManager {
private val application = TvApp.getApplication()
/**
* Check if the app can use Leanback features
* Check if the app can use Leanback features and is API level 26 or higher
*/
private val isSupported = application.packageManager.hasSystemFeature("android.software.leanback")
private val isSupported = Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
&& application.packageManager.hasSystemFeature("android.software.leanback")
/**
* Update all channels for the currently authenticated user