Android从任何应用程序检测触摸状态 [英] Android detecting the touch state from any application

查看:19
本文介绍了Android从任何应用程序检测触摸状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以从另一个应用程序中检测触摸事件,特别是滑动?我希望能够检测到用户是否向左或向右滑动(即使使用 2 个手指 - 但不是必需的).也许有我可以收听的服务或广播.

Is it possible to detect touch events from within another application, specifically swipes? I'd like to be able to detect if the user has swiped left or right (even with 2 fingers - but not required). Perhaps there is a service or broadcast I can listen to.

或者失败了,是否有一些 API 可能我可以每秒轮询 10 次来获取触摸状态,然后我可以计算其余部分(为什么,我记得编写了一个鼠标驱动程序,在 8086 中用 IN OUTs 选通 COM1 端口在 XT 上用 TSR 编码的汇编程序......)!

or failing that, is there some API perhaps that I can poll say 10 times a second to get the touch state and I can compute the rest (why, I remember writing a mouse driver strobing the COM1 port with IN OUTs in 8086 assembler coded in a TSR on a XT...)!

无论如何,任何帮助表示赞赏.(我认为这可以通过劫持主启动器并进行透明的顶部点击活动来实现,但这是严重的欺诈和危险!)

Anyway, any help appreciated. (I think it could be done by hijacking the primary Launcher and having a transparent click-through on-top activity, but that's seriously fraud with danger!)

推荐答案

是否可以从另一个应用程序中检测触摸事件,特别是滑动?

Is it possible to detect touch events from within another application, specifically swipes?

幸运的是,没有.

或者失败了,是否有一些 API 可能我可以每秒轮询 10 次以获得触摸状态,然后我可以计算其余的

or failing that, is there some API perhaps that I can poll say 10 times a second to get the touch state and I can compute the rest

幸运的是,没有.

我认为这可以通过劫持主启动器并在顶部活动中进行透明的点击来实现

I think it could be done by hijacking the primary Launcher and having a transparent click-through on-top activity

幸运的是,没有.

欢迎您编写自己的主屏幕应用程序,在这种情况下,您可以在自己的主屏幕上跟踪自己的触摸事件.欢迎您编写一个普通的应用程序,并在您自己的活动中跟踪您自己的触摸事件.

You are welcome to write your own home screen application, in which case you can track your own touch events on your own home screen. You are welcome to write an ordinary application and track your own touch events on your own activities.

这篇关于Android从任何应用程序检测触摸状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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