android / android/media-samples

The ScreenCapture example doesn't work on API 30+

Open
#86 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Kotlin
Stars
1.4k
Forks
781
PR merge metrics
No merged PRs in 30d

Description

As stated in the title, the ScreenCapture example doesn't work anymore as API 30+ forcefully requires to run any MediaProjection code as a Foreground service, and even as I rewrote the sample code to run that way, it captures a black screen.
I found a ticket in Google's issue tracker stating that bug, so it seems is reported, but still hasn't been addressed https://issuetracker.google.com/issues/214397245?pli=1

This is a huge problem, as most of our application's functionality relies on such feature to work, and if even the Android provided examples fail, we can't upgrade our app to the latest Android API version.

Contributor guide

Open the contributing guide

Research direction

Start with the ScreenCapture example and reproduce the failure on API 30 or newer. Read the MediaProjection and foreground-service requirements, then compare the sample's behavior with the linked Google issue; done would require the example to capture a non-black screen on supported API levels.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.