Skip to content

Instantly share code, notes, and snippets.

@ademirqueiroga
Created February 22, 2023 15:49
Show Gist options
  • Save ademirqueiroga/caae41bc683ad0bdb2de7950993280b3 to your computer and use it in GitHub Desktop.
Save ademirqueiroga/caae41bc683ad0bdb2de7950993280b3 to your computer and use it in GitHub Desktop.
Creating/Updating channels
val existingChannel = queryChannels().firstOrNull {
it.internalProviderId == category.id.toString()
}
val channelBuilder = when (existingChannel) {
null -> Channel.Builder()
else -> Channel.Builder(existingChannel)
}
val channel = channelBuilder
.setType(TvContractCompat.Channels.TYPE_PREVIEW)
.setDisplayName(category.title)
.setInternalProviderId(category.id.toString())
.setAppLinkIntentUri("content://channelsample.com/category/${category.id}".toUri())
.build()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment