Menu

Post image 1
Post image 2
1 / 2
0

Camera2 API: Handling Orientation, Focus, and Exposure in Background — How to Keep Your Android Camera Running With the Screen Off

DEV Community: kotlin·Super Funicular·3 days ago
#F6F86qBH
Reading 0:00
15s threshold

Originally answered on Quora: "How do you record a video with the screen off in Android?" . This is the dev.to canonical — the long, code-level version of the same architecture, written for developers shipping a camera-adjacent Android app. If you've tried to build an Android camera app that records with the screen off, you've hit the wall I'm about to describe. The Camera2 session works fine while the app is foregrounded. You lock the screen. A few seconds later — sometimes thirty, sometimes ten minutes, sometimes after a Doze maintenance window — the frames stop. No exception, no broken pipe, no helpful log. Just silence.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More