1

Is it possible to programmatically take a screenshot of a mobile screen that is currently displaying? I want my app to take a screenshot of another screen after some time from a background service. what I have done already is I am getting the screenshot from the service but it is taking the screenshot of my app activity in which code is written but I want to take a screenshot every 5 mint no matter what screen is on appearing on the mobile from the background screen.

it is possible then help me out, please?

  • Check this answer https://stackoverflow.com/questions/44288546/take-a-screenshot-background-service – Okan Serdaroğlu Apr 04 '20 at 09:46
  • Check this https://stackoverflow.com/questions/44288546/take-a-screenshot-background-service – Okan Serdaroğlu Apr 04 '20 at 09:47
  • @OkanSerdaroğlu MediaProjection API I have tried it I only work as far the app is opened but I want to work it even the app is closed from background – ahsan Farhan Apr 04 '20 at 09:48
  • The media projection APIs definitely work from the background. However, your permission to record the screen lives only for the current process. If your process is terminated, by Android or the user, you would need to request permission again. – CommonsWare Apr 04 '20 at 11:51

1 Answers1

0

Maybe you can create only a receiver ACTION_TIME_TICK. If you declare it in AndroidManifest, this works when app closed also. However this works every minute and you have to control modulus 5 in onReceive and capture screenshot.