How to use MediaProjection to capture screen in a Service?

4.4k views Asked by At

As we know, we can use Android MediaProjection API to capture screen in an Activity, but I want to capture screen in a thread of a Service. But Android Service has no onActivityResult() method that MediaProjection need to do something. It seems that we can only call MediaProjection API like belows:

startActivityForResult(mProjectionManager.createScreenCaptureIntent(), REQUEST_CODE);

Is there a way to use MediaProjection in an Android Service?

0

There are 0 answers