I have the problem: If I use params:
setShowWhenLocked(true)
setTurnScreenOn(true)
in the first activity - it's working correct if I change orientation (from portrait to landscape and back), but if I opened the second activity from the first activity I have screen lock problem: If I change orientation from portrait to landscape the phone open lock screen in landscape mode and after the second activity in portrait mode and it repeats over and over. Sometimes this cycle stops and then the second activity opens in landscape mode.
Maybe somebody knows how I can do correct orientation change not only first activity if the phone in locked state but also on the second activity.
My first activity has the code:
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(....)
setShowOnLockScreen(true)
setTurnScreen(true)
}
override fun onDestroy() {
super.onDestroy()
setShowOnLockScreen(false)
setTurnScreen(false)
}
My second activity also has the code:
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(....)
setShowOnLockScreen(true)
setTurnScreen(true)
}
override fun onDestroy() {
super.onDestroy()
setShowOnLockScreen(false)
setTurnScreen(false)
}
I think that the problem is due to the fact that we already activated the mode on top of the lock in the first activity, and therefore the second activity is no longer processed correctly.