android/media-samples

The ScreenCapture example doesn't work on API 30+

raul-guerrero opened this issue · 1 comments

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.

Yes, I got this error too "Media projections require a foreground service of type ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION". Please help to provide a runnable example.