How to get a continuous image of the screen?

edited March 20 in Android Mode

Hi, I'd like to write an app that involves continuously scanning the screen of an Android device into a PImage variable. How do I do this in real time?

Thanks in advance for your response(s).
Les

Answers

  • You are trying to take screenshot continuously of your phone? I am assuming you are not scanning your actual canvas as this would be trivial. Are you thinking in running your app in the background?

    Kf

  • Actually I would like to know the color of a pixel on the phone's screen. I guess I could either run the app in a little window or in the background, whatever is easier. and it can either be continuously or frequently (5 Hz or so).

    Les

  • Not sure if you could run it in a small window. I believe your app will be lay out on a solid color background if you are not running in fullScreen mode. What pixel in the background are you looking for? have you tried asking in stackoverflow? Did you get any hints through a google search?

    I believe there was a previous post a while ago taking a screenshot using an intent. i will see if I can dig it out for you.

    Kf

  • Actually I want to know the color of the pixel under the user's finger position. I don't know what stack overflow is, and a google search found nothing. Thanks for your efforts.

    Les

  • Ok, and what is under the finger's position? an image that you are displaying?

    Kf

  • well for now yes, i am displaying the camera. ultimately however, i would like to display whatever the user can see on the screen.

    Les

  • Have you run android apps in your phone before? You can start with the ketai library. You can install it through tome library manager. After you install the library, you can access the provided examples. Then after you have the examples running, getting the information you required should be just some few lines, similar to this:

    https://forum.processing.org/two/discussion/comment/90399/#Comment_90399
    https://forum.processing.org/two/search?Page=p2&Search=loadpixels
    https://forum.processing.org/two/discussion/comment/89249/#Comment_89249

    Other relevant search: https://forum.processing.org/two/search?Search=ketai

    Kf

  • @LesterCHall===

    sorry, i am not sure to understand. You speak about camera: ok, but who has launched the cam? is it the user? In this case that means that your app is pausing, yet getting the touchEvents from the user for any reason: it is some kind of spy. Is it your goal?

  • No, my goal is not to spy. It is to provide a service to the disabled community.

    Les

  • @LesterCHall===

    ok, but is my description exact:

    • your app is in the foreground

    • the user is doing something (camera, calendar, contacts...)

    • your app is able to capture the touch events from the user.

  • yes exactly.

  • @akenaton How can an application be in the foreground if the user is doing something else? Did you mean to say the app is running in the background, thinking along the lines of a service?

    Or maybe you are suggesting one can do that by running an application in a multi-window environment? Or is there any other way that you are considering?

    Kf

  • edited March 20

    @kfrajer: i was asking that in order to be sure about what was the question. I have never tried that, yet, if it is possible (&& not forbidden!!!) it could only be made using a broadcast receiver which can (some restrictions) work even if the app is not in the foreground, then asking a service, but what service??? - I don t think that it exists something like touchevent service...But i ll give a look, for fun!

    PS === i say "forbidden" because if possible it could be somethinhk like a keylogger. Digging some more i see that it is exactly why android has blocked the ACTION_OUTSIDE FLAG since kitKat.

  • @akenaton Service as creating your own service... extending from the Service class.

    Kf

  • @akenaton Service as creating your own service... extending from the Service class.

    Kf

  • @kfrajer=== yes, you can create your own service extending the Service class && binding to it but how to capture motionEvents from another app? perhaps AcessibilityService is better for that.

  • ty jeremydouglass, maybe that will help!
    Les

Sign In or Register to comment.