Skip to content

Add Android TV sample app#2697

Merged
xgouchet merged 2 commits into
developfrom
xgouchet/tv_sample_app
Jun 6, 2025
Merged

Add Android TV sample app#2697
xgouchet merged 2 commits into
developfrom
xgouchet/tv_sample_app

Conversation

@xgouchet

@xgouchet xgouchet commented Jun 4, 2025

Copy link
Copy Markdown
Contributor

What does this PR do?

Add an Android TV sample app :

  • lists episodes of the Datadog On podcast (from Datadog's Youtube Channel)
  • plays episode in a dedicated screen

Motivation

Provide a sample app showcasing RUM features on an Android TV app.

@xgouchet
xgouchet requested review from a team as code owners June 4, 2025 13:31
@xgouchet
xgouchet force-pushed the xgouchet/tv_sample_app branch from 3a8cf6d to 46f08b2 Compare June 4, 2025 13:38
ambushwork
ambushwork previously approved these changes Jun 4, 2025
Comment thread gradle/libs.versions.toml
"glideOkHttp3",
]

exoplayer = [

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I know, exoplayer is deprecated, shouldn't we use androidx-media3 to have a better test case?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a cherry-pick of a sample app made a while back. It might take too long to upgrade to media3 although you're right it would be nice to do eventually

Comment thread sample/tv/build.gradle.kts Outdated
implementation("androidx.lifecycle:lifecycle-livedata-ktx:2.6.1")
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1")
implementation("androidx.navigation:navigation-fragment-ktx:2.5.2")
implementation("androidx.navigation:navigation-ui-ktx:2.5.2")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: maybe put them into libs.versions.toml

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

0xnm
0xnm previously approved these changes Jun 4, 2025

@0xnm 0xnm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice addition!

}

@Suppress("UnstableApiUsage")
fun ApplicationDefaultConfig.configureFlavorForTvApp(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we simply reuse config and method for the sample app? Or we don't want create flavors for TV app?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using flavors won't work as the UI and logic is completely different.
Reusing the config means mixing data from different apps in the same RUM App (so even if apps can share a client token, they have a different Application ID)

Comment thread sample/tv/build.gradle.kts Outdated
kotlin("android")
kotlin("kapt")
id("com.github.ben-manes.versions")
id("org.jetbrains.dokka")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably this one is not needed? we have it by some reason also in the sample app buildscript 🤔

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment thread sample/tv/build.gradle.kts Outdated
plugins {
id("com.android.application")
kotlin("android")
kotlin("kapt")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not needed, because there is no kapt processing here. Same for the KSP plugin below.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment thread sample/tv/build.gradle.kts Outdated

// Video
implementation(libs.bundles.exoplayer)
implementation("com.github.TeamNewPipe.NewPipeExtractor:extractor:v0.24.6")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is better to move this to libs.versions.toml

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment thread sample/tv/build.gradle.kts Outdated
}
}
junitConfig()
javadocConfig()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not needed, it is a sample app

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment on lines +58 to +60
Thread {
loadAndPlayVideo(intentUri)
}.start()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe this (and in other similar places) is a good use-case for Kotlin Coroutines in this app

)
)
)
// .addInterceptor {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should it be left commented out?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch

}

val body = response.body
var responseBodyToReturn: String? = null

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: we can make it val responseBodyToReturn = response.body?.let { it.string() }

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector> No newline at end of file

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
</vector>
</vector>

android:layout_width="match_parent"
android:layout_height="match_parent"/>

</androidx.constraintlayout.widget.ConstraintLayout> No newline at end of file

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

minor: this missing newline at EOF can be applied to multiple files

@xgouchet
xgouchet dismissed stale reviews from 0xnm and ambushwork via 94cf708 June 4, 2025 14:16
@xgouchet
xgouchet force-pushed the xgouchet/tv_sample_app branch from 46f08b2 to 94cf708 Compare June 4, 2025 14:16
@codecov-commenter

codecov-commenter commented Jun 4, 2025

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 69.95%. Comparing base (e2c7dfa) to head (08e7f0d).
Report is 2 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2697      +/-   ##
===========================================
+ Coverage    69.95%   69.95%   +0.01%     
===========================================
  Files          822      822              
  Lines        30693    30693              
  Branches      5170     5170              
===========================================
+ Hits         21469    21471       +2     
- Misses        7775     7778       +3     
+ Partials      1449     1444       -5     

see 35 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@xgouchet
xgouchet requested a review from 0xnm June 5, 2025 07:38
@xgouchet
xgouchet force-pushed the xgouchet/tv_sample_app branch from 94cf708 to 08e7f0d Compare June 5, 2025 07:38
@xgouchet
xgouchet requested a review from ambushwork June 5, 2025 07:38
@xgouchet
xgouchet merged commit ffc7e94 into develop Jun 6, 2025
@xgouchet
xgouchet deleted the xgouchet/tv_sample_app branch June 6, 2025 06:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants