-->

ScreenCapture via MediaProjection without user int

2019-05-28 19:36发布

问题:

I work for a digital signage company which has Android devices running in kiosk mode. Lately, we wanted to add screen capture for debugging. The easiest way to do that was to use

getWindow().getDecorView().getRootView().getDrawingCache()

to create bitmap and to send it over the network, but this will not capture videos as it's been rendered in surface view.

MediaProjection's createVirtualDisplay seems promising, but the explicit permission needed to use this feature is not acceptable. Even requesting user permission for the first time and persisting the result for further use is not acceptable as this will disrupt the existing implementations.

Please help me out in addressing this issue.

Note: All the devices out there, are either rooted or, our app runs as device owner and, the android version is above 4.4