Since you don't say anything about the application I assume you don't have the possibility to change it or to simply replace it with a different application which can receive requests for actions via other means, e.g. it has a CLI. If you do have the freedom to replace the app, then choose something which is command-line based and just execute the app with the correct parameters when the sensor triggers.
I'm also assuming that the application receiving the keys runs on the rpi.
Using the xdotool and a bit of experimenting you could find a window attribute which uniquely defines the GUI element of your application that needs to receive the keystroke. Then you could execute xdotool with the right set of parameters whenever the sensor event occurs. This will take some effort but it is totally doable.
Look at this link for an actual "project" that uses xdotool on the raspbian.