I want to generate a touch event via programming on the screen outside of my app. My app currently has a floating window. I am trying to make something like repetitouch I used the Hover library to create a floating window to display some message and buttons. I tried following this answer but the Hover library doesn't provide me with any views to work on [ when I try to use view.dispatchTouchEvent(motionEvent); ] The ClassName.this, getView() and all don't work. Is there any other floating window library which provides views after implementation so that I can generate touches via code. Can I do this task using services? If yes, what should I use?
I found my solution. I used instrumentation.
InstrumentationObj.sendPointerSync(MotionEvent.obtain(SystemClock.uptimeMillis(), SystemClock.uptimeMillis(), MotionEvent.ACTION_DOWN, x_coordinate, y_coordinate, 0));