5

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?

coder.john
  • 1,235
  • 2
  • 12
  • 11
  • My App has no Activity but only a Service. – coder.john Jul 05 '18 at 02:51
  • Possible duplicate of [How do I get a media projection manager without disturbing the current foreground process, except to ask for permission?](https://stackoverflow.com/questions/33398211/how-do-i-get-a-media-projection-manager-without-disturbing-the-current-foregroun) – Stephen M -on strike- Oct 17 '18 at 15:28
  • Another possible duplicate: https://stackoverflow.com/questions/32381455/android-mediaprojectionmanager-in-service#32849121 – Stephen M -on strike- Oct 17 '18 at 15:29

0 Answers0