Question
Is it possible to capture the device lock screen on Android devices during Twilio Video sessions using the native SDK?
Product
Twilio Video
Answer
When the device screen locks during an active session, it is expected that the streamed video goes blank instead of showing the lock screen.
Even when disabling the FLAG_SECURE flag, it is expected Twilio Video's ScreenCapturer (via media projection) will terminate on screen lock. You can find more details in the Android docs related to media projection here.
Workarounds on this appear limited, and may require custom lock screens, device policy changes, or deep OEM modifications.
Additional Information
You can find our ScreenCapturer docs and example code here for reference:
And as far as application backgrounding on Android generally, a Service can be used to manage the lifecycle of a Room:
You may want to reference this code from the Android quickstart for handling of putting the app in the background / foreground: