How can I use java.awt.Robot inside games?

I am developing an Android application that controls the keyboard and mouse of a PC. I wanted to add a new feature (using your mobile as a game controller). I am using java.awt.Robot

. It works great with keyboard and mouse control. But when i used it with games it java.awt.Robot

doesn't click buttons. When I go outside the game, it works fine again.

For example:

if (senderPropertyOne.equalsIgnoreCase("l")) {
} else if (senderPropertyOne.equalsIgnoreCase("r")) {
} else if (senderPropertyOne.equalsIgnoreCase("u")) {
} else if (senderPropertyOne.equalsIgnoreCase("d")) {


This works great on internet flash games, but when I run a normal game on my PC (like Evolution Football) it doesn't work.


source to share

2 answers

Thanks for not helping me. I was able to fix this issue, published Android app with 100,000 downloads :)

I was developing an Android app that allowed an Android phone to control a PC and use an Android phone as a PC game controller. I was using TCP and ran into an issue that I cannot control.

When I used UDP instead, the problem was fixed. I don't know if TCP was the root cause or not, but my problem has been fixed and my app is published on the Android market :)



Btw ... the problem is the awt package is not part of Android, so you cannot use it.



All Articles