安卓:模拟键盘输入的物理按键preSS [英] Android: simulate a physical button press of keyboard input

查看:182
本文介绍了安卓:模拟键盘输入的物理按键preSS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这可能是有点暧昧的问题,但我会尽我所能在描述什么我想做的事情。我需要将触发一个物理按键preSS或输入code到当前活动的应用程序的服务。我试图做一个映射为Xperia播放触摸板,使他们能够与应用程序和游戏中使用不支持他们,但映射每个轴角落物理键盘键或输入。

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.

我能想象这样的功能将是一个安全风险在标准Android SDK中包含的,虽然我可能是错在这种情况下可能有某种意图或接收器来处理这些事件。

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?

推荐答案

您不能做这在一个正常的应用程序,但你还有其他两个选项根据您的需求:

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


  • 的Andr​​oid SDK的 MonkeyRunner 可以自动化输入

  • 使用root用户直接操作的Andr​​oid键盘事件;我知道有与Xorg的Linux工具,但我不知道他们是否会在Android上工作:输入xvkbd xdotool

  • 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

这篇关于安卓:模拟键盘输入的物理按键preSS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆