Here in my code snippet:
val uri: Uri = TvContractCompat.Channels.CONTENT_URI
context.contentResolver.query(uri, null, null, null, null)?.let { cursor->
if(cursor.count > 0) {
cursor.moveToFirst()
do {
val channel = Channel.fromCursor(cursor)
} while (cursor.moveToNext() && cursor.isLast.not())
}
}
I get following error message:
2021-03-11 20:32:29.509 7285-7285/com.example.tvapp E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.tvapp, PID: 7285 java.lang.SecurityException: Selection not allowed for content://android.media.tv/channel at android.os.Parcel.createException(Parcel.java:1950) at android.os.Parcel.readException(Parcel.java:1918) at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:183) at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:135) at android.content.ContentProviderProxy.query(ContentProviderNative.java:418) at android.content.ContentResolver.query(ContentResolver.java:802) at android.content.ContentResolver.query(ContentResolver.java:752) at android.content.ContentResolver.query(ContentResolver.java:710)
In my Manifest I already have:
<uses-permission android:name="com.android.providers.tv.permission.READ_EPG_DATA" />
<uses-permission android:name="com.android.providers.tv.permission.ACCESS_ALL_EPG_DATA"/>
Since I do not write anything to EPG I do not have the other permission:
Anyway, also with that permission, I get that errror.
Btw. when I run the app from my /system folder (a bit higher access level) the code is working and I get the Channels