0

I am developing an android application. In which I want to take snapshot when the application is running in background. But I came to know that background services doesn't allow taking screenshot using background services, Please guide me what should I do ?

Mario
  • 1,230
  • 7
  • 14
user3664164
  • 69
  • 1
  • 2
  • 4
  • 2
    Well, it is not allowed for a good reason. Imagine any application could take screenshots while running in background. These screenshots could be uploaded to a server, where the developers could see everything the customer does with his phone. So, what do YOU need this feature for? – PKlumpp Sep 04 '14 at 10:50
  • Actually. i am creating security App. in which parent can monitor weather their childrens are doing good activity with their cellphone or going on wrong way. – user3664164 Sep 04 '14 at 11:03
  • Did you find a solution? – DevSab Aug 06 '17 at 12:41

1 Answers1

0

This is ''not'' allowed and probably won't ever be. That's an outright violation of the trust you're being given by your users. Imagine an app that periodically takes screenshots, OCR's them to find the passwords, data and images, just to send you results. It's as scary as it sounds.

Potentially you could periodically launch a ''transparent'' theme activity (read about it here) in which you would be able to take a screenshot, however:

1) Don't do it.

2) All the underlying activities are put onPause() which is pure rage for anyone who'll see it.

3) Don't do it.

4) If you still want to do it for some reason, don't.

5) I believe you potentially could be banned for such an application on the Play store.

Community
  • 1
  • 1
Jitsu
  • 769
  • 3
  • 7
  • Thank you for Link. But, i am creating an security app. for family. i know this app might be banned to playstore. I am agree with your comment. but i would like to request you. if you can suggest me alternate way.My questions are :
    1. How to make it possible when parent want to see screen of their chlidren when parent thinks that their childrens are doing some misleading activities. OR 2. how to make it possible that our childrens will not be aware of that their parents are keeping watch on him/her.
    – user3664164 Sep 04 '14 at 11:17
  • @Jitsu: "Potentially you could periodically launch a ''transparent'' theme activity (read about it here) in which you would be able to take a screenshot" -- that should show an empty screen. The only way to take a "screenshot" is to have the activity render its UI to a `Canvas`, and that UI does not contain the pixels showing through a transparent background. – CommonsWare Sep 04 '14 at 11:18
  • isn't it possible. like, when my child is watching youtube. and i want to take screenshot of that screen. will transparent screen give empty screen or it will give the screen of youtube player ? – user3664164 Sep 04 '14 at 11:21
  • It will give empty screen probably, as the playback is going to be paused. Eventually you could use a dialog with SYSTEM_ALERT flag. – Jitsu Sep 05 '14 at 11:47
  • is there any alternate way ? i heard that there are two ways to take snapshot. either your device need to be rooted. OR you will have to deal with ADB and using USB debugging mode you have to enable background service to take snapshot. – user3664164 Sep 05 '14 at 20:23