如何创建一个可以点击其他应用程序的自动点击器应用程序?

如何创建一个可以点击其他应用程序的自动点击器应用程序?

问题描述:

我见过很多提供自动点击功能的应用.但是他们不提供一些特定的定制,所以我决定创建一个.我看过很多提供自动点击的教程,但它们应该在同一个应用程序中使用.但我想创建一个可以点击其他应用程序视图的自动点击应用程序.我是一名中级 Java 开发人员,但对 Android Studio 不熟悉,所以我对 Android API 了解不多.是否有任何类或包可以提供此功能.为了获得更多许可,我想做自动点击,当屏幕上特定位置的颜色(例如 (213, 120) 变为绿色时).提前致谢!

I have seen so many apps that provide auto tapping feature. But they don't provide some specific customization so I decided to create a one. I have seen many tutorials that offers auto tapping, but they are supposed to be used in the same app. But I want to create an auto tapping app that can click on other app's View. I am an intermediate java developer but new to Android studio, so I don't know much about Android APIs. Is there any class or package which can provide this feature. For more clearance, I want to do auto tap, when the color at the specific location on screen, (213, 120) for instance, becomes green. Thanks in advance!

我不是这方面的专家,我有后端开发人员的经验,我是 Android 世界的新手,就像你一样我对构建感兴趣一个应用程序,用于在具有特定行为的 Android 游戏中自动化一些农业机制,因此我调查了该主题,您正在寻找的解决方案是 AccessibilityService API,从 Android 8.0(API 级别 26)开始,它包括几个无需进行触摸的功能对于 Root,我给你留下了一些可以指导你的开源代码库示例的链接.

I am not an expert on the subject, I have experience as a BackEnd developer, I am new to the Android world, just like you I am interested in building an app to automate some farming mechanics in Android games with specific behaviors, so I investigated on the subject and the solution you are looking for is the AccessibilityService API, from Android 8.0 (API level 26) it includes several functionalities to make touches without the need for Root, I leave you links with examples of some open source repos that can guide you.

https://developer.android.com/guide/主题/ui/accessibility/service#continued-gestures(文档)https://github.com/nestorm001/AutoClicker(旧的废弃项目,但有touches的功能)https://github.com/pylapp/SmoothClicker(比较成熟的App但是需要root,可以有助于指导您如何构建 UI)

https://developer.android.com/guide/topics/ui/accessibility/service#continued-gestures (Doc) https://github.com/nestorm001/AutoClicker (Old and abandoned project, but has the functionality of touches) https://github.com/pylapp/SmoothClicker (A more mature App but need root, it can be helpful to guide you in how to build the UI)

对于像素变化的检测我仍然没有具体的答案,我一直在寻找,也许每X次获取屏幕的转储并验证像素的方式,但仍然不确定是否这是要走的路.像这样 如何记录屏幕和截屏,使用Android API?.我知道如果您有活动,您可以获得屏幕上的一个位图,但事实并非如此,但是此包中的某些类可能会有所帮助 https://developer.android.com/reference/kotlin/android/graphics/package-summary

For the detection in the change of the pixel I still do not have a concrete answer, I keep looking, maybe obtaining a dump of the screen every X time and validate the pixels on that is the way but it is still uncertain if it is the way to go. Something like this How to record screen and take screenshots, using Android API?. I know that you can get a bitmat dumb of the screen if you have the activity, but it's not the case, however some class in this package may be helpful https://developer.android.com/reference/kotlin/android/graphics/package-summary

我目前正在自己​​的实现中工作,当我有东西要展示时,我会很乐意分享.

I'm currently working in my own implementation, when I have something to show I will gladly share it.