Appearance
Screen Behavior
Workout sessions typically require the screen to remain awake.
Permission
Add in AndroidManifest.xml:
xml
<uses-permission android:name="android.permission.WAKE_LOCK" />Activity flags
kotlin
override fun onResume() {
super.onResume()
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
}
override fun onStop() {
super.onStop()
window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
}This keeps the screen active during workout playback and restores default behavior once the workout ends.
