Sensor which detects things on screen

I have been planning to make an app which constantly refreshes a certain webpage, at a certain amount of time, which I have been able to do, there is 2 issues which I am facing currently, where I think 1 cannot be helped unless a new feature is added by MIT AppInventor itself, nonetheless, I shall address both the issue down here and hope for a reply!

  1. The first issue that I am facing is that the app is unable to run in the background, which upon further research I found, that AppInventor currently does not support running apps in the background, but since the community post was a couple of months old I decided to ask again whether if this is a possibility now or not...

  2. The other issue the major one is that I must have it so that there is a sensor on the screen which on an 'x' period of seconds rechecks the position/colour of an object appearing on the screen, and then accordingly send out signals, the issue that I am facing is that although I will be able to code it out I am unable to find the right sensor which I need to use to detect a certain (x,y) coordinates at a certain time interval, I want to know if there is such a sensor or a way to code something in such a way to detect that

TLDR - I want to find a sensor that can detect the colour/ text on my screen, it would be great if I could be guided to that

  • Tejasveer Singh
  1. There are no built-in methods to make the app run in the background. There are various extensions that make this possible.
  2. If you ask for a sensor that will check the color on a webpage loaded on webwiever, this is impossible. The only component that allows you to examine the background color is canvas. What you want to do, maybe could be done with a screenshot. You take a screenshot, load the image as the background of the canvas component, then examine the color.

Hello Tejasveer.

View Patryk's comments. Here is a little more information.

App Inventor 2 can not run in the background using native Blocks. There are one or two extensions that claim this capability (find them here App Inventor Extensions | Pura Vida Apps or do a search).

Something like that does not exist.

Not a sensor. If your screen is a Canvas, there is a Block that can determine the color of a part of the screen. See Canvas using these Methods:

  • GetBackgroundPixelColor( x , y ) gets the color of the given pixel, ignoring sprites.

  • GetPixelColor( x , y ) gets the color of the given pixel, including sprites.

There may be an extension but probably will not do exactly what you home to do.

Hi, what extension is there that allows the app to run in the background, the basic idea is for the app to load up a specific web page and depending upon the colour present on the x,y co-ord send out a notification to the phone and thus preferably running the background, thus what extensions are there which can help us out?

Hey, so does that mean I need to take a screenshot ever 'x' seconds, but the app is in the background thus the screenshot is of the home screen, so how does it help? The main idea is for the app to open a webpage and refresh it every 5 seconds and check for the colour change of a certain position and then accordingly send a notification, so it is not possible right?

Is it your webpage? Do you have control of it?

If you do then you could use a JavaScript solution, such as using setInterval() and checking the ID of the element you want to track and watch for color and or position change. You could then send the results to the App via the WebViewStringChange Event.

Mike.