Here is an example of an app that does something similar that . You might adapt the aia to your purposes.
Your app probably would work better if you used a virtual screen than a real Screen. Coding that would be complex. Using a virtual screen would be easier.