I am writing a very simple app with a service in the foreground that basically send a notification to the user with the screen coordinates of that last touch event.
The touch event can of course occur anywhere, not just inside the scope (the main activity pretty much) of my app.
Even though my Service implements View.OnTouchListener
and overriding
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
System.out.println(motionEvent.getRawX());
System.out.println(motionEvent.getRawY());
return false;
}
I am not able to trigger the touch event. So, I am wondering if I should draw an invisible dummy overlay view in order to achieve this.
If so, it has to be an invisible view with the size of the whole screen or it could be also just a pixel?