Linkandzelda
Linkandzelda

Reputation: 611

Android: simulate a physical button press of keyboard input

This might be a bit of an ambiguous question but I'll do my best at describing what I want to do. I need to make a service that will trigger a physical button press or input code to the currently active application. I'm trying to make a mapper for the Xperia Play touch pads so they can be used with apps and games that don't support them but mapping each axis corner to a physical keyboard key or input.

I can imagine such a feature would be a security risk to include in the standard Android SDK, although I may be wrong in which case there might be some kind of Intent or Receiver to handle those events.

If there isn't, does anyone know how I could go about doing what I want to do?

Upvotes: 1

Views: 2767

Answers (2)

devsnd
devsnd

Reputation: 7722

You cannot do this in a normal App, but you have two other options depending on your needs:

  • Android SDKs MonkeyRunner lets you automate input
  • Using root to directly manipulate the keyboard events in android; I know that there are tools for linux with Xorg, but I'm not sure if they will work on android: xvkbd or xdotool

Upvotes: 0

Robin
Robin

Reputation: 10368

Try sendkey command in you adb shell.

You cannot do it in application yet.

Upvotes: 1

Related Questions