Android的跨应用的关系 [英] Android Inter-app relations

查看:217
本文介绍了Android的跨应用的关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

虽然有相关矿井的问题,没有一个是相当回答他们对什么我一直在寻找的程度。首先,是有可能有一个可下载的Andr​​oid应用程序运行在另一个应用的顶部,也就是说,它模拟一个pre定义的用户输入,并没有一个传统的鬼。例如,(假设)如果我有这样的播放视频,但被设置为自动关闭屏幕,每10秒,我想一个onTouch事件每隔几秒钟,以prevent这个应用程序。没有什么复杂的,刚好接触,也许几个挥笔,并与他们一起去的其他事件。

While there are questions relevant to mine, none are quite answering them to the extent of what I was looking for. First off, is it possible to have a downloadable Android app that "runs on top of another app" that is, it emulates a pre-defined user input and doesn't have a traditional "gui." For example, (hypothetically) if I had an app that plays videos but is set to auto turn off the screen every 10 seconds, I would want an onTouch event every few seconds in order to prevent this. Nothing complicated, just touches, maybe a few swipes, and the other events that go along with them.

其次,如果这不是创建一个应用程序的有效方式,没有接口,只要pre定义脚本,是有,我可以任何其他方式注入上触摸事件进入一个应用程序,没有开源?

Secondly, if this is not a valid way to create an app "with no interface, just a pre-defined script, is there any other way that I could "inject" on-touch events into an app that isn't open-source?

编辑:
更具体地讲,我在看打短平快的应用程序帮助,一种程序,当激活,运行pre定义一套以极高的速度模拟用户输入的指令,因此,认为执行某些活动(比如从对象A刷卡对象B)和背部非常快的应用程序。我也已经在寻找不同的Andr​​oid设备的速度阈值,以找到一个共同的(最大)一个将所有设备的正常工作。

To be more specific, I'm looking at making a "quick" app helper, a sort of program that when activated, runs a pre-defined set of instructions that emulate user input at very high speed, so, think of an app that performs some activity (like swiping from object A to object B) and back REALLY fast. I'm also already looking at speed thresholds on different android devices to find a common (maximum) one that would work for all devices.

推荐答案

您想要的 android.app.Instrumentation 类。这使您可以发送各种各样的事件在应用程序和监测结果。

You want the android.app.Instrumentation class. This lets you send a wide variety of events to an application and monitor the results.

要成功地使用这个类,你的应用程序必须有INJECT_EVENTS许可,<一个href=\"http://stackoverflow.com/questions/3598662/how-to-compile-android-application-with-system-permissions\">must可与系统签名密钥的签名。这意味着你需要可正常工作的扎根设备上自己的自定义固件。您将无法使用运营商提供的firwmare做到这一点。

To use this class successfully, your app must have the INJECT_EVENTS permission and must be signed with the system signing key. This means you need to be working on a rooted device with your own custom firmware. You won't be able to do this with carrier-provided firwmare.

如果您的解决方案并不需要成为一个.apk文件,那么你可以尝试使用 monkeyrunner 。这只需要你能够与亚行连接的设备(即USB调试为设备启用)。

If your solution doesn't need to be an .apk, then you can try using monkeyrunner. This only requires that you are able to connect to the device with adb (i.e. USB debugging is enabled for the device).

这篇关于Android的跨应用的关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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