title: Can I programatically generate a touch event in Android from background app on keypress?
body: <p>What I want to do is when I press a certain keyboard button or combination, a touch event should be fired with given screen coordinates.</p>
  
  <p>I would like to use a physical keyboard connected to an Android device. I want to write code which runs in the background continuously and listens for a specific combination and then when it is pressed a touch event is created with specific coordinates. The touch event should be received by whatever app which is in foreground.</p>
  
  <p>To be more specific, I find it annoying that the Facebook Messenger app does not send messages when I press enter but inserts a newline in the textbox. Or at least it would be nice to have an option to enable or disable this feature, like the Windows Phone version of the app. But it does not have this option, and it drives me crazy when I type my messages on the physical keyboard and have to touch the little button on the phone itself, moving my hand from the keyboard, or I have to use tabbing navigation to select the button control and then press enter.</p>
  
  <p>This app would primarily be for personal use, and I am asking this question to make sure that it is even possible to write such code and to improve my knowledge.</p>