Hello I'm building a weak AI (a bot) app on android but I'm fairly new to this.
Context: The app is/will be composed of an UI to start/stop the bot and modify his settings, screen caputure service taking screenshot at fixed intervals (let's say every 5 sec for example), an image recognition module(OpenCv) and a touch simulation service(Instrumentation class, MotionEvent class). Apart from UI obviously, every module should be abble to run in background once the bot is launched.
Question: What is the most efficient, senseful way to make a service that can capture screen at fixed intervals from background?
I looked for MediaProjection API doc and demos then I started to make an IntentService that use MediaProjection to record screen and a Timer + scheduled TimerTask to save bitmaps but i'm a bit lost. Here is what I have so far:
Removed
I feel I'm doing it wrong. Can you help me to figure out how to do this with explanations, advices, snippets, tutos or anything helpful please?
Edit: Indeed this is much more simple to achieve this using Runtime to execute adb shell commands. Plus this allow to make image processing on the computer which is faster